Commit fa7f28939634c2ea36817a0c3dbd8d84972c1488
Committed by
Linus Torvalds
1 parent
a6a26a3e65
Exists in
master
and in
4 other branches
zorro: use memory_read_from_buffer
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>
Showing 1 changed file with 2 additions and 8 deletions Side-by-side Diff
drivers/zorro/zorro-sysfs.c
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | #include <linux/zorro.h> |
16 | 16 | #include <linux/stat.h> |
17 | 17 | #include <linux/string.h> |
18 | +#include <linux/fs.h> | |
18 | 19 | |
19 | 20 | #include "zorro.h" |
20 | 21 | |
21 | 22 | |
... | ... | @@ -56,13 +57,7 @@ |
56 | 57 | struct zorro_dev *z = to_zorro_dev(container_of(kobj, struct device, |
57 | 58 | kobj)); |
58 | 59 | struct ConfigDev cd; |
59 | - unsigned int size = sizeof(cd); | |
60 | 60 | |
61 | - if (off > size) | |
62 | - return 0; | |
63 | - if (off+count > size) | |
64 | - count = size-off; | |
65 | - | |
66 | 61 | /* Construct a ConfigDev */ |
67 | 62 | memset(&cd, 0, sizeof(cd)); |
68 | 63 | cd.cd_Rom = z->rom; |
... | ... | @@ -71,8 +66,7 @@ |
71 | 66 | cd.cd_BoardAddr = (void *)zorro_resource_start(z); |
72 | 67 | cd.cd_BoardSize = zorro_resource_len(z); |
73 | 68 | |
74 | - memcpy(buf, (void *)&cd+off, count); | |
75 | - return count; | |
69 | + return memory_read_from_buffer(buf, count, &off, &cd, sizeof(cd)); | |
76 | 70 | } |
77 | 71 | |
78 | 72 | static struct bin_attribute zorro_config_attr = { |