From: Akinobu Mita Date: Mon, 14 Jul 2008 07:59:15 +0000 (+0200) Subject: [S390] s390/cio: use memory_read_from_buffer() X-Git-Tag: v2.6.27-rc1~1112^2~31 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=d9cef21af03eb56473db5bb20d8754f377a498e7;p=linux-2.6-omap-h63xx.git [S390] s390/cio: use memory_read_from_buffer() Signed-off-by: Akinobu Mita Cc: Peter Oberparleiter Signed-off-by: Andrew Morton Signed-off-by Heiko Carstens Signed-off-by: Martin Schwidefsky --- diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c index 8644c80a205..d58dc9f15b7 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, { struct channel_path *chp; struct device *device; - unsigned int size; device = container_of(kobj, struct device, kobj); chp = to_channelpath(device); if (!chp->cmg_chars) return 0; - size = sizeof(struct cmg_chars); - - if (off > size) - return 0; - if (off + count > size) - count = size - off; - memcpy(buf, chp->cmg_chars + off, count); - return count; + return memory_read_from_buffer(buf, count, &off, + chp->cmg_chars, sizeof(struct cmg_chars)); } static struct bin_attribute chp_measurement_chars_attr = {