diff options
author | Michael Tokarev <mjt@tls.mks.ru> | 2006-09-27 01:50:56 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-27 08:26:19 -0700 |
commit | 07563c711fbc25389e58ab9c9f0b9de2fce56760 (patch) | |
tree | aadbe41b9303c636a2c44169680613b8b56d5006 /drivers/eisa/eisa-bus.c | |
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>
Diffstat (limited to 'drivers/eisa/eisa-bus.c')
-rw-r--r-- | drivers/eisa/eisa-bus.c | 23 |
1 files changed, 23 insertions, 0 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) return 0; } +static int eisa_bus_uevent(struct device *dev, char **envp, int num_envp, + char *buffer, int buffer_size) +{ + struct eisa_device *edev = to_eisa_device(dev); + int i = 0; + int length = 0; + + add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, + "MODALIAS=" EISA_DEVICE_MODALIAS_FMT, edev->id.sig); + envp[i] = NULL; + return 0; +} + struct bus_type eisa_bus_type = { .name = "eisa", .match = eisa_bus_match, + .uevent = eisa_bus_uevent, }; 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 static DEVICE_ATTR(enabled, S_IRUGO, eisa_show_state, NULL); +static ssize_t eisa_show_modalias (struct device *dev, struct device_attribute *attr, char *buf) +{ + struct eisa_device *edev = to_eisa_device (dev); + return sprintf (buf, EISA_DEVICE_MODALIAS_FMT "\n", edev->id.sig); +} + +static DEVICE_ATTR(modalias, S_IRUGO, eisa_show_modalias, NULL); + static int __init eisa_init_device (struct eisa_root_device *root, struct eisa_device *edev, int slot) @@ -209,6 +231,7 @@ static int __init eisa_register_device (struct eisa_device *edev) device_create_file (&edev->dev, &dev_attr_signature); device_create_file (&edev->dev, &dev_attr_enabled); + device_create_file (&edev->dev, &dev_attr_modalias); return 0; } |