diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2013-10-04 03:38:53 -0400 |
---|---|---|
committer | Geert Uytterhoeven <geert@linux-m68k.org> | 2013-11-26 05:09:09 -0500 |
commit | bd9ba8f40ee30edf31cc0845d8838bc43d172ef3 (patch) | |
tree | 4c073ce3a53d7cccbc3ac7335854d424faa2c289 /drivers/zorro | |
parent | 986ea58dfb52097999cc388880505fc7a10e4779 (diff) |
zorro/UAPI: Use proper types (endianness/size) in <linux/zorro.h>
Fix member definitions for non-native userspace handling:
- All multi-byte values are big-endian, hence use __be*,
- All pointers are 32-bit pointers under AmigaOS, but unused (except for
cd_BoardAddr) under Linux, hence use __be32.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'drivers/zorro')
-rw-r--r-- | drivers/zorro/proc.c | 10 | ||||
-rw-r--r-- | drivers/zorro/zorro-sysfs.c | 22 | ||||
-rw-r--r-- | drivers/zorro/zorro.c | 4 |
3 files changed, 26 insertions, 10 deletions
diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c index ea1ce822a8e0..6ac2579da0eb 100644 --- a/drivers/zorro/proc.c +++ b/drivers/zorro/proc.c | |||
@@ -14,6 +14,8 @@ | |||
14 | #include <linux/seq_file.h> | 14 | #include <linux/seq_file.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/export.h> | 16 | #include <linux/export.h> |
17 | |||
18 | #include <asm/byteorder.h> | ||
17 | #include <asm/uaccess.h> | 19 | #include <asm/uaccess.h> |
18 | #include <asm/amigahw.h> | 20 | #include <asm/amigahw.h> |
19 | #include <asm/setup.h> | 21 | #include <asm/setup.h> |
@@ -41,10 +43,10 @@ proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t * | |||
41 | /* Construct a ConfigDev */ | 43 | /* Construct a ConfigDev */ |
42 | memset(&cd, 0, sizeof(cd)); | 44 | memset(&cd, 0, sizeof(cd)); |
43 | cd.cd_Rom = z->rom; | 45 | cd.cd_Rom = z->rom; |
44 | cd.cd_SlotAddr = z->slotaddr; | 46 | cd.cd_SlotAddr = cpu_to_be16(z->slotaddr); |
45 | cd.cd_SlotSize = z->slotsize; | 47 | cd.cd_SlotSize = cpu_to_be16(z->slotsize); |
46 | cd.cd_BoardAddr = (void *)zorro_resource_start(z); | 48 | cd.cd_BoardAddr = cpu_to_be32(zorro_resource_start(z)); |
47 | cd.cd_BoardSize = zorro_resource_len(z); | 49 | cd.cd_BoardSize = cpu_to_be32(zorro_resource_len(z)); |
48 | 50 | ||
49 | if (copy_to_user(buf, (void *)&cd + pos, nbytes)) | 51 | if (copy_to_user(buf, (void *)&cd + pos, nbytes)) |
50 | return -EFAULT; | 52 | return -EFAULT; |
diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c index 26f7184ef9e1..36b210f9b6b2 100644 --- a/drivers/zorro/zorro-sysfs.c +++ b/drivers/zorro/zorro-sysfs.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/stat.h> | 16 | #include <linux/stat.h> |
17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
18 | 18 | ||
19 | #include <asm/byteorder.h> | ||
20 | |||
19 | #include "zorro.h" | 21 | #include "zorro.h" |
20 | 22 | ||
21 | 23 | ||
@@ -33,10 +35,20 @@ static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL); | |||
33 | 35 | ||
34 | zorro_config_attr(id, id, "0x%08x\n"); | 36 | zorro_config_attr(id, id, "0x%08x\n"); |
35 | zorro_config_attr(type, rom.er_Type, "0x%02x\n"); | 37 | zorro_config_attr(type, rom.er_Type, "0x%02x\n"); |
36 | zorro_config_attr(serial, rom.er_SerialNumber, "0x%08x\n"); | ||
37 | zorro_config_attr(slotaddr, slotaddr, "0x%04x\n"); | 38 | zorro_config_attr(slotaddr, slotaddr, "0x%04x\n"); |
38 | zorro_config_attr(slotsize, slotsize, "0x%04x\n"); | 39 | zorro_config_attr(slotsize, slotsize, "0x%04x\n"); |
39 | 40 | ||
41 | static ssize_t | ||
42 | show_serial(struct device *dev, struct device_attribute *attr, char *buf) | ||
43 | { | ||
44 | struct zorro_dev *z; | ||
45 | |||
46 | z = to_zorro_dev(dev); | ||
47 | return sprintf(buf, "0x%08x\n", be32_to_cpu(z->rom.er_SerialNumber)); | ||
48 | } | ||
49 | |||
50 | static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL); | ||
51 | |||
40 | static ssize_t zorro_show_resource(struct device *dev, struct device_attribute *attr, char *buf) | 52 | static ssize_t zorro_show_resource(struct device *dev, struct device_attribute *attr, char *buf) |
41 | { | 53 | { |
42 | struct zorro_dev *z = to_zorro_dev(dev); | 54 | struct zorro_dev *z = to_zorro_dev(dev); |
@@ -60,10 +72,10 @@ static ssize_t zorro_read_config(struct file *filp, struct kobject *kobj, | |||
60 | /* Construct a ConfigDev */ | 72 | /* Construct a ConfigDev */ |
61 | memset(&cd, 0, sizeof(cd)); | 73 | memset(&cd, 0, sizeof(cd)); |
62 | cd.cd_Rom = z->rom; | 74 | cd.cd_Rom = z->rom; |
63 | cd.cd_SlotAddr = z->slotaddr; | 75 | cd.cd_SlotAddr = cpu_to_be16(z->slotaddr); |
64 | cd.cd_SlotSize = z->slotsize; | 76 | cd.cd_SlotSize = cpu_to_be16(z->slotsize); |
65 | cd.cd_BoardAddr = (void *)zorro_resource_start(z); | 77 | cd.cd_BoardAddr = cpu_to_be32(zorro_resource_start(z)); |
66 | cd.cd_BoardSize = zorro_resource_len(z); | 78 | cd.cd_BoardSize = cpu_to_be32(zorro_resource_len(z)); |
67 | 79 | ||
68 | return memory_read_from_buffer(buf, count, &off, &cd, sizeof(cd)); | 80 | return memory_read_from_buffer(buf, count, &off, &cd, sizeof(cd)); |
69 | } | 81 | } |
diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c index 450abf100f06..707c1a5a0317 100644 --- a/drivers/zorro/zorro.c +++ b/drivers/zorro/zorro.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | 20 | ||
21 | #include <asm/byteorder.h> | ||
21 | #include <asm/setup.h> | 22 | #include <asm/setup.h> |
22 | #include <asm/amigahw.h> | 23 | #include <asm/amigahw.h> |
23 | 24 | ||
@@ -161,7 +162,8 @@ static int __init amiga_zorro_probe(struct platform_device *pdev) | |||
161 | z = &zorro_autocon[i]; | 162 | z = &zorro_autocon[i]; |
162 | 163 | ||
163 | z->rom = zi->rom; | 164 | z->rom = zi->rom; |
164 | z->id = (z->rom.er_Manufacturer<<16) | (z->rom.er_Product<<8); | 165 | z->id = (be16_to_cpu(z->rom.er_Manufacturer) << 16) | |
166 | (z->rom.er_Product << 8); | ||
165 | if (z->id == ZORRO_PROD_GVP_EPC_BASE) { | 167 | if (z->id == ZORRO_PROD_GVP_EPC_BASE) { |
166 | /* GVP quirk */ | 168 | /* GVP quirk */ |
167 | unsigned long magic = zi->boardaddr + 0x8000; | 169 | unsigned long magic = zi->boardaddr + 0x8000; |