瀏覽代碼

[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>
Akinobu Mita 17 年之前
父節點
當前提交
d9cef21af0
共有 1 個文件被更改,包括 2 次插入9 次删除
  1. 2 9
      drivers/s390/cio/chp.c

+ 2 - 9
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 = {