diff options
Diffstat (limited to 'drivers/zorro/zorro-sysfs.c')
-rw-r--r-- | drivers/zorro/zorro-sysfs.c | 10 |
1 files changed, 2 insertions, 8 deletions
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 @@ | |||
15 | #include <linux/zorro.h> | 15 | #include <linux/zorro.h> |
16 | #include <linux/stat.h> | 16 | #include <linux/stat.h> |
17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
18 | #include <linux/fs.h> | ||
18 | 19 | ||
19 | #include "zorro.h" | 20 | #include "zorro.h" |
20 | 21 | ||
@@ -56,12 +57,6 @@ static ssize_t zorro_read_config(struct kobject *kobj, | |||
56 | struct zorro_dev *z = to_zorro_dev(container_of(kobj, struct device, | 57 | struct zorro_dev *z = to_zorro_dev(container_of(kobj, struct device, |
57 | kobj)); | 58 | kobj)); |
58 | struct ConfigDev cd; | 59 | struct ConfigDev cd; |
59 | unsigned int size = sizeof(cd); | ||
60 | |||
61 | if (off > size) | ||
62 | return 0; | ||
63 | if (off+count > size) | ||
64 | count = size-off; | ||
65 | 60 | ||
66 | /* Construct a ConfigDev */ | 61 | /* Construct a ConfigDev */ |
67 | memset(&cd, 0, sizeof(cd)); | 62 | memset(&cd, 0, sizeof(cd)); |
@@ -71,8 +66,7 @@ static ssize_t zorro_read_config(struct kobject *kobj, | |||
71 | cd.cd_BoardAddr = (void *)zorro_resource_start(z); | 66 | cd.cd_BoardAddr = (void *)zorro_resource_start(z); |
72 | cd.cd_BoardSize = zorro_resource_len(z); | 67 | cd.cd_BoardSize = zorro_resource_len(z); |
73 | 68 | ||
74 | memcpy(buf, (void *)&cd+off, count); | 69 | return memory_read_from_buffer(buf, count, &off, &cd, sizeof(cd)); |
75 | return count; | ||
76 | } | 70 | } |
77 | 71 | ||
78 | static struct bin_attribute zorro_config_attr = { | 72 | static struct bin_attribute zorro_config_attr = { |