From akinobu.mita@gmail.com Mon Jun 2 01:32:58 2008 Date: Mon, 02 Jun 2008 08:13:48 +0900 From: akinobu.mita@gmail.com To: linux-kernel@vger.kernel.org Cc: Geert Uytterhoeven Subject: [patch -v2 19/23] zorro: use memory_read_from_buffer Signed-off-by: Akinobu Mita Cc: Geert Uytterhoeven --- drivers/zorro/zorro-sysfs.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) --- 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 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 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 = {