diff options
author | Michael Tokarev <mjt@tls.mks.ru> | 2006-09-27 04:50:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-27 11:26:19 -0400 |
commit | 07563c711fbc25389e58ab9c9f0b9de2fce56760 (patch) | |
tree | aadbe41b9303c636a2c44169680613b8b56d5006 | |
parent | ebba5f9fcb882306bef7175dee987342ec6fcf2f (diff) |
[PATCH] EISA bus MODALIAS attributes support
Add modalias attribute support for the almost forgotten now EISA bus and
(at least some) EISA-aware modules.
The modalias entry looks like (for an 3c509 NIC):
eisa:sTCM5093
and the in-module alias like:
eisa:sTCM5093*
The patch moves struct eisa_device_id declaration from include/linux/eisa.h
to include/linux/mod_devicetable.h (so that the former now #includes the
latter), adds proper MODULE_DEVICE_TABLE(eisa, ...) statements for all
drivers with EISA IDs I found (some drivers already have that DEVICE_TABLE
declared), and adds recognision of __mod_eisa_device_table to
scripts/mod/file2alias.c so that proper modules.alias will be generated.
There's no support for /lib/modules/$kver/modules.eisamap, as it's not used
by any existing tools, and because with in-kernel modalias mechanism those
maps are obsolete anyway.
The rationale for this patch is:
a) to make EISA bus to act as other busses with modalias
support, to unify driver loading
b) to foget about EISA finally - with this patch, kernel
(who still supports EISA) will be the only one who knows
how to choose the necessary drivers for this bus ;)
[akpm@osdl.org: fix the kbuild bit]
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Acked-the-net-bits-by: Jeff Garzik <jeff@garzik.org>
Acked-the-tulip-bit-by: Valerie Henson <val_henson@linux.intel.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/eisa/eisa-bus.c | 23 | ||||
-rw-r--r-- | drivers/net/3c509.c | 1 | ||||
-rw-r--r-- | drivers/net/3c59x.c | 1 | ||||
-rw-r--r-- | drivers/net/ne3210.c | 1 | ||||
-rw-r--r-- | drivers/net/tulip/de4x5.c | 1 | ||||
-rw-r--r-- | drivers/scsi/aha1740.c | 1 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic7770_osm.c | 3 | ||||
-rw-r--r-- | drivers/scsi/sim710.c | 1 | ||||
-rw-r--r-- | include/linux/eisa.h | 8 | ||||
-rw-r--r-- | include/linux/mod_devicetable.h | 12 | ||||
-rw-r--r-- | scripts/mod/file2alias.c | 12 |
11 files changed, 56 insertions, 8 deletions
diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c index 6078e2f58817..3a365e159d89 100644 --- a/drivers/eisa/eisa-bus.c +++ b/drivers/eisa/eisa-bus.c | |||
@@ -128,9 +128,23 @@ static int eisa_bus_match (struct device *dev, struct device_driver *drv) | |||
128 | return 0; | 128 | return 0; |
129 | } | 129 | } |
130 | 130 | ||
131 | static int eisa_bus_uevent(struct device *dev, char **envp, int num_envp, | ||
132 | char *buffer, int buffer_size) | ||
133 | { | ||
134 | struct eisa_device *edev = to_eisa_device(dev); | ||
135 | int i = 0; | ||
136 | int length = 0; | ||
137 | |||
138 | add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, | ||
139 | "MODALIAS=" EISA_DEVICE_MODALIAS_FMT, edev->id.sig); | ||
140 | envp[i] = NULL; | ||
141 | return 0; | ||
142 | } | ||
143 | |||
131 | struct bus_type eisa_bus_type = { | 144 | struct bus_type eisa_bus_type = { |
132 | .name = "eisa", | 145 | .name = "eisa", |
133 | .match = eisa_bus_match, | 146 | .match = eisa_bus_match, |
147 | .uevent = eisa_bus_uevent, | ||
134 | }; | 148 | }; |
135 | 149 | ||
136 | int eisa_driver_register (struct eisa_driver *edrv) | 150 | int eisa_driver_register (struct eisa_driver *edrv) |
@@ -160,6 +174,14 @@ static ssize_t eisa_show_state (struct device *dev, struct device_attribute *att | |||
160 | 174 | ||
161 | static DEVICE_ATTR(enabled, S_IRUGO, eisa_show_state, NULL); | 175 | static DEVICE_ATTR(enabled, S_IRUGO, eisa_show_state, NULL); |
162 | 176 | ||
177 | static ssize_t eisa_show_modalias (struct device *dev, struct device_attribute *attr, char *buf) | ||
178 | { | ||
179 | struct eisa_device *edev = to_eisa_device (dev); | ||
180 | return sprintf (buf, EISA_DEVICE_MODALIAS_FMT "\n", edev->id.sig); | ||
181 | } | ||
182 | |||
183 | static DEVICE_ATTR(modalias, S_IRUGO, eisa_show_modalias, NULL); | ||
184 | |||
163 | static int __init eisa_init_device (struct eisa_root_device *root, | 185 | static int __init eisa_init_device (struct eisa_root_device *root, |
164 | struct eisa_device *edev, | 186 | struct eisa_device *edev, |
165 | int slot) | 187 | int slot) |
@@ -209,6 +231,7 @@ static int __init eisa_register_device (struct eisa_device *edev) | |||
209 | 231 | ||
210 | device_create_file (&edev->dev, &dev_attr_signature); | 232 | device_create_file (&edev->dev, &dev_attr_signature); |
211 | device_create_file (&edev->dev, &dev_attr_enabled); | 233 | device_create_file (&edev->dev, &dev_attr_enabled); |
234 | device_create_file (&edev->dev, &dev_attr_modalias); | ||
212 | 235 | ||
213 | return 0; | 236 | return 0; |
214 | } | 237 | } |
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c index 59c33925be62..b936373ab2a5 100644 --- a/drivers/net/3c509.c +++ b/drivers/net/3c509.c | |||
@@ -225,6 +225,7 @@ static struct eisa_device_id el3_eisa_ids[] = { | |||
225 | { "TCM5095" }, | 225 | { "TCM5095" }, |
226 | { "" } | 226 | { "" } |
227 | }; | 227 | }; |
228 | MODULE_DEVICE_TABLE(eisa, el3_eisa_ids); | ||
228 | 229 | ||
229 | static int el3_eisa_probe (struct device *device); | 230 | static int el3_eisa_probe (struct device *device); |
230 | 231 | ||
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index af301f09d674..df42e28cc80f 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -851,6 +851,7 @@ static struct eisa_device_id vortex_eisa_ids[] = { | |||
851 | { "TCM5970", CH_3C597 }, | 851 | { "TCM5970", CH_3C597 }, |
852 | { "" } | 852 | { "" } |
853 | }; | 853 | }; |
854 | MODULE_DEVICE_TABLE(eisa, vortex_eisa_ids); | ||
854 | 855 | ||
855 | static int vortex_eisa_probe(struct device *device); | 856 | static int vortex_eisa_probe(struct device *device); |
856 | static int vortex_eisa_remove(struct device *device); | 857 | static int vortex_eisa_remove(struct device *device); |
diff --git a/drivers/net/ne3210.c b/drivers/net/ne3210.c index 0fa8e4d22769..d66328975425 100644 --- a/drivers/net/ne3210.c +++ b/drivers/net/ne3210.c | |||
@@ -343,6 +343,7 @@ static struct eisa_device_id ne3210_ids[] = { | |||
343 | { "NVL1801" }, | 343 | { "NVL1801" }, |
344 | { "" }, | 344 | { "" }, |
345 | }; | 345 | }; |
346 | MODULE_DEVICE_TABLE(eisa, ne3210_ids); | ||
346 | 347 | ||
347 | static struct eisa_driver ne3210_eisa_driver = { | 348 | static struct eisa_driver ne3210_eisa_driver = { |
348 | .id_table = ne3210_ids, | 349 | .id_table = ne3210_ids, |
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c index e661d0a9cc64..fb5fa7d68888 100644 --- a/drivers/net/tulip/de4x5.c +++ b/drivers/net/tulip/de4x5.c | |||
@@ -2114,6 +2114,7 @@ static struct eisa_device_id de4x5_eisa_ids[] = { | |||
2114 | { "DEC4250", 0 }, /* 0 is the board name index... */ | 2114 | { "DEC4250", 0 }, /* 0 is the board name index... */ |
2115 | { "" } | 2115 | { "" } |
2116 | }; | 2116 | }; |
2117 | MODULE_DEVICE_TABLE(eisa, de4x5_eisa_ids); | ||
2117 | 2118 | ||
2118 | static struct eisa_driver de4x5_eisa_driver = { | 2119 | static struct eisa_driver de4x5_eisa_driver = { |
2119 | .id_table = de4x5_eisa_ids, | 2120 | .id_table = de4x5_eisa_ids, |
diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c index 0e4a7ebe300a..6b35ed8301e0 100644 --- a/drivers/scsi/aha1740.c +++ b/drivers/scsi/aha1740.c | |||
@@ -681,6 +681,7 @@ static struct eisa_device_id aha1740_ids[] = { | |||
681 | { "ADP0400" }, /* 1744 */ | 681 | { "ADP0400" }, /* 1744 */ |
682 | { "" } | 682 | { "" } |
683 | }; | 683 | }; |
684 | MODULE_DEVICE_TABLE(eisa, aha1740_ids); | ||
684 | 685 | ||
685 | static struct eisa_driver aha1740_driver = { | 686 | static struct eisa_driver aha1740_driver = { |
686 | .id_table = aha1740_ids, | 687 | .id_table = aha1740_ids, |
diff --git a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7770_osm.c index 867cbe23579b..1ac119733bac 100644 --- a/drivers/scsi/aic7xxx/aic7770_osm.c +++ b/drivers/scsi/aic7xxx/aic7770_osm.c | |||
@@ -132,7 +132,8 @@ static struct eisa_device_id aic7770_ids[] = { | |||
132 | { "ADP7770", 5 }, /* AIC7770 generic */ | 132 | { "ADP7770", 5 }, /* AIC7770 generic */ |
133 | { "" } | 133 | { "" } |
134 | }; | 134 | }; |
135 | 135 | MODULE_DEVICE_TABLE(eisa, aic7770_ids); | |
136 | |||
136 | static struct eisa_driver aic7770_driver = { | 137 | static struct eisa_driver aic7770_driver = { |
137 | .id_table = aic7770_ids, | 138 | .id_table = aic7770_ids, |
138 | .driver = { | 139 | .driver = { |
diff --git a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c index b27e85428daa..551baccec523 100644 --- a/drivers/scsi/sim710.c +++ b/drivers/scsi/sim710.c | |||
@@ -282,6 +282,7 @@ static struct eisa_device_id sim710_eisa_ids[] = { | |||
282 | { "HWP0C80" }, | 282 | { "HWP0C80" }, |
283 | { "" } | 283 | { "" } |
284 | }; | 284 | }; |
285 | MODULE_DEVICE_TABLE(eisa, sim710_eisa_ids); | ||
285 | 286 | ||
286 | static __init int | 287 | static __init int |
287 | sim710_eisa_probe(struct device *dev) | 288 | sim710_eisa_probe(struct device *dev) |
diff --git a/include/linux/eisa.h b/include/linux/eisa.h index 4079242dced8..1ff7c1392525 100644 --- a/include/linux/eisa.h +++ b/include/linux/eisa.h | |||
@@ -3,8 +3,8 @@ | |||
3 | 3 | ||
4 | #include <linux/ioport.h> | 4 | #include <linux/ioport.h> |
5 | #include <linux/device.h> | 5 | #include <linux/device.h> |
6 | #include <linux/mod_devicetable.h> | ||
6 | 7 | ||
7 | #define EISA_SIG_LEN 8 | ||
8 | #define EISA_MAX_SLOTS 8 | 8 | #define EISA_MAX_SLOTS 8 |
9 | 9 | ||
10 | #define EISA_MAX_RESOURCES 4 | 10 | #define EISA_MAX_RESOURCES 4 |
@@ -27,12 +27,6 @@ | |||
27 | #define EISA_CONFIG_ENABLED 1 | 27 | #define EISA_CONFIG_ENABLED 1 |
28 | #define EISA_CONFIG_FORCED 2 | 28 | #define EISA_CONFIG_FORCED 2 |
29 | 29 | ||
30 | /* The EISA signature, in ASCII form, null terminated */ | ||
31 | struct eisa_device_id { | ||
32 | char sig[EISA_SIG_LEN]; | ||
33 | unsigned long driver_data; | ||
34 | }; | ||
35 | |||
36 | /* There is not much we can say about an EISA device, apart from | 30 | /* There is not much we can say about an EISA device, apart from |
37 | * signature, slot number, and base address. dma_mask is set by | 31 | * signature, slot number, and base address. dma_mask is set by |
38 | * default to parent device mask..*/ | 32 | * default to parent device mask..*/ |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index f7ca0b09075d..e0c393cc7240 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -308,4 +308,16 @@ struct input_device_id { | |||
308 | kernel_ulong_t driver_info; | 308 | kernel_ulong_t driver_info; |
309 | }; | 309 | }; |
310 | 310 | ||
311 | /* EISA */ | ||
312 | |||
313 | #define EISA_SIG_LEN 8 | ||
314 | |||
315 | /* The EISA signature, in ASCII form, null terminated */ | ||
316 | struct eisa_device_id { | ||
317 | char sig[EISA_SIG_LEN]; | ||
318 | kernel_ulong_t driver_data; | ||
319 | }; | ||
320 | |||
321 | #define EISA_DEVICE_MODALIAS_FMT "eisa:s%s" | ||
322 | |||
311 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 323 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index de76da80443f..f61c9ccef6aa 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -444,6 +444,14 @@ static int do_input_entry(const char *filename, struct input_device_id *id, | |||
444 | return 1; | 444 | return 1; |
445 | } | 445 | } |
446 | 446 | ||
447 | static int do_eisa_entry(const char *filename, struct eisa_device_id *eisa, | ||
448 | char *alias) | ||
449 | { | ||
450 | if (eisa->sig[0]) | ||
451 | sprintf(alias, EISA_DEVICE_MODALIAS_FMT "*", eisa->sig); | ||
452 | return 1; | ||
453 | } | ||
454 | |||
447 | /* Ignore any prefix, eg. v850 prepends _ */ | 455 | /* Ignore any prefix, eg. v850 prepends _ */ |
448 | static inline int sym_is(const char *symbol, const char *name) | 456 | static inline int sym_is(const char *symbol, const char *name) |
449 | { | 457 | { |
@@ -547,6 +555,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
547 | do_table(symval, sym->st_size, | 555 | do_table(symval, sym->st_size, |
548 | sizeof(struct input_device_id), "input", | 556 | sizeof(struct input_device_id), "input", |
549 | do_input_entry, mod); | 557 | do_input_entry, mod); |
558 | else if (sym_is(symname, "__mod_eisa_device_table")) | ||
559 | do_table(symval, sym->st_size, | ||
560 | sizeof(struct eisa_device_id), "eisa", | ||
561 | do_eisa_entry, mod); | ||
550 | } | 562 | } |
551 | 563 | ||
552 | /* Now add out buffered information to the generated C source */ | 564 | /* Now add out buffered information to the generated C source */ |