From: akinobu.mita@gmail.com Date: Thu, 17 Jul 2008 19:16:17 +0000 (+0200) Subject: zorro: use memory_read_from_buffer X-Git-Tag: firefly_0821_release~19585 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fa7f28939634c2ea36817a0c3dbd8d84972c1488;p=firefly-linux-kernel-4.4.55.git zorro: use memory_read_from_buffer zorro: use memory_read_from_buffer Signed-off-by: Akinobu Mita Signed-off-by: Geert Uytterhoeven Signed-off-by: Linus Torvalds --- diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c index 808b4f8675c5..3da712cc7708 100644 --- a/drivers/zorro/zorro-sysfs.c +++ b/drivers/zorro/zorro-sysfs.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "zorro.h" @@ -56,12 +57,6 @@ static ssize_t zorro_read_config(struct kobject *kobj, struct zorro_dev *z = to_zorro_dev(container_of(kobj, struct device, kobj)); struct ConfigDev cd; - unsigned int size = sizeof(cd); - - if (off > size) - return 0; - if (off+count > size) - count = size-off; /* Construct a ConfigDev */ memset(&cd, 0, sizeof(cd)); @@ -71,8 +66,7 @@ static ssize_t zorro_read_config(struct kobject *kobj, cd.cd_BoardAddr = (void *)zorro_resource_start(z); cd.cd_BoardSize = zorro_resource_len(z); - memcpy(buf, (void *)&cd+off, count); - return count; + return memory_read_from_buffer(buf, count, &off, &cd, sizeof(cd)); } static struct bin_attribute zorro_config_attr = {