]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
zorro: use memory_read_from_buffer
authorakinobu.mita@gmail.com <akinobu.mita@gmail.com>
Thu, 17 Jul 2008 19:16:17 +0000 (21:16 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 21 Jul 2008 00:24:38 +0000 (17:24 -0700)
zorro: use memory_read_from_buffer

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/zorro/zorro-sysfs.c

index 808b4f8675c5609ccd195deb755c40233ddf3059..3da712cc7708c43986765f13e2b51880ba7aca39 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/zorro.h>
 #include <linux/stat.h>
 #include <linux/string.h>
+#include <linux/fs.h>
 
 #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 = {