aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2008-11-18 15:13:53 -0500
committerGeert Uytterhoeven <geert@linux-m68k.org>2010-05-17 15:37:41 -0400
commitbf54a2b3c0dbf76136f00ff785bf6d8f6291311d (patch)
tree918d2a181a90454a2893c2a86640ef72b3a164f4
parent0b7f1a7efb38b551f5948a13d0b36e876ba536db (diff)
m68k: amiga - Zorro bus modalias support
Add Amiga Zorro bus modalias and uevent support Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
-rw-r--r--drivers/net/a2065.c1
-rw-r--r--drivers/net/ariadne.c1
-rw-r--r--drivers/net/hydra.c1
-rw-r--r--drivers/net/zorro8390.c1
-rw-r--r--drivers/scsi/zorro7xx.c1
-rw-r--r--drivers/video/cirrusfb.c1
-rw-r--r--drivers/video/fm2fb.c1
-rw-r--r--drivers/zorro/zorro-driver.c24
-rw-r--r--drivers/zorro/zorro-sysfs.c11
-rw-r--r--include/linux/mod_devicetable.h9
-rw-r--r--include/linux/zorro.h13
-rw-r--r--scripts/mod/file2alias.c14
12 files changed, 66 insertions, 12 deletions
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c
index ed5e9742be2c..a8f0512bad38 100644
--- a/drivers/net/a2065.c
+++ b/drivers/net/a2065.c
@@ -674,6 +674,7 @@ static struct zorro_device_id a2065_zorro_tbl[] __devinitdata = {
674 { ZORRO_PROD_AMERISTAR_A2065 }, 674 { ZORRO_PROD_AMERISTAR_A2065 },
675 { 0 } 675 { 0 }
676}; 676};
677MODULE_DEVICE_TABLE(zorro, a2065_zorro_tbl);
677 678
678static struct zorro_driver a2065_driver = { 679static struct zorro_driver a2065_driver = {
679 .name = "a2065", 680 .name = "a2065",
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c
index fa1a2354f5f9..4b30a46486e2 100644
--- a/drivers/net/ariadne.c
+++ b/drivers/net/ariadne.c
@@ -145,6 +145,7 @@ static struct zorro_device_id ariadne_zorro_tbl[] __devinitdata = {
145 { ZORRO_PROD_VILLAGE_TRONIC_ARIADNE }, 145 { ZORRO_PROD_VILLAGE_TRONIC_ARIADNE },
146 { 0 } 146 { 0 }
147}; 147};
148MODULE_DEVICE_TABLE(zorro, ariadne_zorro_tbl);
148 149
149static struct zorro_driver ariadne_driver = { 150static struct zorro_driver ariadne_driver = {
150 .name = "ariadne", 151 .name = "ariadne",
diff --git a/drivers/net/hydra.c b/drivers/net/hydra.c
index 24724b4ad709..07d8e5b634f3 100644
--- a/drivers/net/hydra.c
+++ b/drivers/net/hydra.c
@@ -71,6 +71,7 @@ static struct zorro_device_id hydra_zorro_tbl[] __devinitdata = {
71 { ZORRO_PROD_HYDRA_SYSTEMS_AMIGANET }, 71 { ZORRO_PROD_HYDRA_SYSTEMS_AMIGANET },
72 { 0 } 72 { 0 }
73}; 73};
74MODULE_DEVICE_TABLE(zorro, hydra_zorro_tbl);
74 75
75static struct zorro_driver hydra_driver = { 76static struct zorro_driver hydra_driver = {
76 .name = "hydra", 77 .name = "hydra",
diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c
index 81c753a617ab..9548cbb5012a 100644
--- a/drivers/net/zorro8390.c
+++ b/drivers/net/zorro8390.c
@@ -102,6 +102,7 @@ static struct zorro_device_id zorro8390_zorro_tbl[] __devinitdata = {
102 { ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, }, 102 { ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, },
103 { 0 } 103 { 0 }
104}; 104};
105MODULE_DEVICE_TABLE(zorro, zorro8390_zorro_tbl);
105 106
106static struct zorro_driver zorro8390_driver = { 107static struct zorro_driver zorro8390_driver = {
107 .name = "zorro8390", 108 .name = "zorro8390",
diff --git a/drivers/scsi/zorro7xx.c b/drivers/scsi/zorro7xx.c
index 105449c15fa9..e17764d71476 100644
--- a/drivers/scsi/zorro7xx.c
+++ b/drivers/scsi/zorro7xx.c
@@ -69,6 +69,7 @@ static struct zorro_device_id zorro7xx_zorro_tbl[] __devinitdata = {
69 }, 69 },
70 { 0 } 70 { 0 }
71}; 71};
72MODULE_DEVICE_TABLE(zorro, zorro7xx_zorro_tbl);
72 73
73static int __devinit zorro7xx_init_one(struct zorro_dev *z, 74static int __devinit zorro7xx_init_one(struct zorro_dev *z,
74 const struct zorro_device_id *ent) 75 const struct zorro_device_id *ent)
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c
index 8d8dfda2f868..6df7c54db0a3 100644
--- a/drivers/video/cirrusfb.c
+++ b/drivers/video/cirrusfb.c
@@ -299,6 +299,7 @@ static const struct zorro_device_id cirrusfb_zorro_table[] = {
299 }, 299 },
300 { 0 } 300 { 0 }
301}; 301};
302MODULE_DEVICE_TABLE(zorro, cirrusfb_zorro_table);
302 303
303static const struct { 304static const struct {
304 zorro_id id2; 305 zorro_id id2;
diff --git a/drivers/video/fm2fb.c b/drivers/video/fm2fb.c
index 6c91c61cdb63..1b0feb8e7244 100644
--- a/drivers/video/fm2fb.c
+++ b/drivers/video/fm2fb.c
@@ -219,6 +219,7 @@ static struct zorro_device_id fm2fb_devices[] __devinitdata = {
219 { ZORRO_PROD_HELFRICH_RAINBOW_II }, 219 { ZORRO_PROD_HELFRICH_RAINBOW_II },
220 { 0 } 220 { 0 }
221}; 221};
222MODULE_DEVICE_TABLE(zorro, fm2fb_devices);
222 223
223static struct zorro_driver fm2fb_driver = { 224static struct zorro_driver fm2fb_driver = {
224 .name = "fm2fb", 225 .name = "fm2fb",
diff --git a/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c
index 53180a37cc9a..7ee2b6e71786 100644
--- a/drivers/zorro/zorro-driver.c
+++ b/drivers/zorro/zorro-driver.c
@@ -137,10 +137,34 @@ static int zorro_bus_match(struct device *dev, struct device_driver *drv)
137 return 0; 137 return 0;
138} 138}
139 139
140static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)
141{
142#ifdef CONFIG_HOTPLUG
143 struct zorro_dev *z;
144
145 if (!dev)
146 return -ENODEV;
147
148 z = to_zorro_dev(dev);
149 if (!z)
150 return -ENODEV;
151
152 if (add_uevent_var(env, "ZORRO_ID=%08X", z->id) ||
153 add_uevent_var(env, "ZORRO_SLOT_NAME=%s", dev_name(dev)) ||
154 add_uevent_var(env, "ZORRO_SLOT_ADDR=%04X", z->slotaddr) ||
155 add_uevent_var(env, "MODALIAS=" ZORRO_DEVICE_MODALIAS_FMT, z->id))
156 return -ENOMEM;
157
158 return 0;
159#else /* !CONFIG_HOTPLUG */
160 return -ENODEV;
161#endif /* !CONFIG_HOTPLUG */
162}
140 163
141struct bus_type zorro_bus_type = { 164struct bus_type zorro_bus_type = {
142 .name = "zorro", 165 .name = "zorro",
143 .match = zorro_bus_match, 166 .match = zorro_bus_match,
167 .uevent = zorro_uevent,
144 .probe = zorro_device_probe, 168 .probe = zorro_device_probe,
145 .remove = zorro_device_remove, 169 .remove = zorro_device_remove,
146}; 170};
diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c
index 1d2a772ea14c..eb924e0a64ce 100644
--- a/drivers/zorro/zorro-sysfs.c
+++ b/drivers/zorro/zorro-sysfs.c
@@ -77,6 +77,16 @@ static struct bin_attribute zorro_config_attr = {
77 .read = zorro_read_config, 77 .read = zorro_read_config,
78}; 78};
79 79
80static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
81 char *buf)
82{
83 struct zorro_dev *z = to_zorro_dev(dev);
84
85 return sprintf(buf, ZORRO_DEVICE_MODALIAS_FMT "\n", z->id);
86}
87
88static DEVICE_ATTR(modalias, S_IRUGO, modalias_show, NULL);
89
80int zorro_create_sysfs_dev_files(struct zorro_dev *z) 90int zorro_create_sysfs_dev_files(struct zorro_dev *z)
81{ 91{
82 struct device *dev = &z->dev; 92 struct device *dev = &z->dev;
@@ -89,6 +99,7 @@ int zorro_create_sysfs_dev_files(struct zorro_dev *z)
89 (error = device_create_file(dev, &dev_attr_slotaddr)) || 99 (error = device_create_file(dev, &dev_attr_slotaddr)) ||
90 (error = device_create_file(dev, &dev_attr_slotsize)) || 100 (error = device_create_file(dev, &dev_attr_slotsize)) ||
91 (error = device_create_file(dev, &dev_attr_resource)) || 101 (error = device_create_file(dev, &dev_attr_resource)) ||
102 (error = device_create_file(dev, &dev_attr_modalias)) ||
92 (error = sysfs_create_bin_file(&dev->kobj, &zorro_config_attr))) 103 (error = sysfs_create_bin_file(&dev->kobj, &zorro_config_attr)))
93 return error; 104 return error;
94 105
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index f58e9d836f32..56fde4364e4c 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -474,4 +474,13 @@ struct platform_device_id {
474 __attribute__((aligned(sizeof(kernel_ulong_t)))); 474 __attribute__((aligned(sizeof(kernel_ulong_t))));
475}; 475};
476 476
477struct zorro_device_id {
478 __u32 id; /* Device ID or ZORRO_WILDCARD */
479 kernel_ulong_t driver_data; /* Data private to the driver */
480};
481
482#define ZORRO_WILDCARD (0xffffffff) /* not official */
483
484#define ZORRO_DEVICE_MODALIAS_FMT "zorro:i%08X"
485
477#endif /* LINUX_MOD_DEVICETABLE_H */ 486#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/zorro.h b/include/linux/zorro.h
index 913bfc226dda..908db1b36d6c 100644
--- a/include/linux/zorro.h
+++ b/include/linux/zorro.h
@@ -38,8 +38,6 @@
38typedef __u32 zorro_id; 38typedef __u32 zorro_id;
39 39
40 40
41#define ZORRO_WILDCARD (0xffffffff) /* not official */
42
43/* Include the ID list */ 41/* Include the ID list */
44#include <linux/zorro_ids.h> 42#include <linux/zorro_ids.h>
45 43
@@ -116,6 +114,7 @@ struct ConfigDev {
116 114
117#include <linux/init.h> 115#include <linux/init.h>
118#include <linux/ioport.h> 116#include <linux/ioport.h>
117#include <linux/mod_devicetable.h>
119 118
120#include <asm/zorro.h> 119#include <asm/zorro.h>
121 120
@@ -155,16 +154,6 @@ extern struct bus_type zorro_bus_type;
155 154
156 155
157 /* 156 /*
158 * Zorro device IDs
159 */
160
161struct zorro_device_id {
162 zorro_id id; /* Device ID or ZORRO_WILDCARD */
163 unsigned long driver_data; /* Data private to the driver */
164};
165
166
167 /*
168 * Zorro device drivers 157 * Zorro device drivers
169 */ 158 */
170 159
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 220213e603db..df90f31d14bf 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -796,6 +796,16 @@ static int do_platform_entry(const char *filename,
796 return 1; 796 return 1;
797} 797}
798 798
799/* Looks like: zorro:iN. */
800static int do_zorro_entry(const char *filename, struct zorro_device_id *id,
801 char *alias)
802{
803 id->id = TO_NATIVE(id->id);
804 strcpy(alias, "zorro:");
805 ADD(alias, "i", id->id != ZORRO_WILDCARD, id->id);
806 return 1;
807}
808
799/* Ignore any prefix, eg. some architectures prepend _ */ 809/* Ignore any prefix, eg. some architectures prepend _ */
800static inline int sym_is(const char *symbol, const char *name) 810static inline int sym_is(const char *symbol, const char *name)
801{ 811{
@@ -943,6 +953,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
943 do_table(symval, sym->st_size, 953 do_table(symval, sym->st_size,
944 sizeof(struct platform_device_id), "platform", 954 sizeof(struct platform_device_id), "platform",
945 do_platform_entry, mod); 955 do_platform_entry, mod);
956 else if (sym_is(symname, "__mod_zorro_device_table"))
957 do_table(symval, sym->st_size,
958 sizeof(struct zorro_device_id), "zorro",
959 do_zorro_entry, mod);
946 free(zeros); 960 free(zeros);
947} 961}
948 962