Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[pandora-kernel.git] / drivers / zorro / zorro-sysfs.c
index 9130f1c..5290552 100644 (file)
@@ -56,12 +56,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,14 +65,13 @@ 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 = {
        .attr = {
                .name = "config",
-               .mode = S_IRUGO | S_IWUSR,
+               .mode = S_IRUGO,
        },
        .size = sizeof(struct ConfigDev),
        .read = zorro_read_config,