aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2008-07-14 03:59:15 -0400
committerHeiko Carstens <heiko.carstens@de.ibm.com>2008-07-14 04:02:15 -0400
commitd9cef21af03eb56473db5bb20d8754f377a498e7 (patch)
tree6d4fde0ab8bbd16d4e12fdc95e9570fe957af5bf
parent7785857a5a4f3e2093ced12568744a205e164d59 (diff)
[S390] s390/cio: use memory_read_from_buffer()
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--drivers/s390/cio/chp.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c
index 8644c80a2056..d58dc9f15b72 100644
--- a/drivers/s390/cio/chp.c
+++ b/drivers/s390/cio/chp.c
@@ -143,21 +143,14 @@ static ssize_t chp_measurement_chars_read(struct kobject *kobj,
143{ 143{
144 struct channel_path *chp; 144 struct channel_path *chp;
145 struct device *device; 145 struct device *device;
146 unsigned int size;
147 146
148 device = container_of(kobj, struct device, kobj); 147 device = container_of(kobj, struct device, kobj);
149 chp = to_channelpath(device); 148 chp = to_channelpath(device);
150 if (!chp->cmg_chars) 149 if (!chp->cmg_chars)
151 return 0; 150 return 0;
152 151
153 size = sizeof(struct cmg_chars); 152 return memory_read_from_buffer(buf, count, &off,
154 153 chp->cmg_chars, sizeof(struct cmg_chars));
155 if (off > size)
156 return 0;
157 if (off + count > size)
158 count = size - off;
159 memcpy(buf, chp->cmg_chars + off, count);
160 return count;
161} 154}
162 155
163static struct bin_attribute chp_measurement_chars_attr = { 156static struct bin_attribute chp_measurement_chars_attr = {