aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-01-15 14:50:02 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-07 13:37:12 -0500
commit725522b5453dd680412f2b6463a988e4fd148757 (patch)
tree45ebe3c30f974ce2311781db428cd3ba4cb4364c
parentfe480a2675ed236af396597d9f05245c7bbd0149 (diff)
PCI: add the sysfs driver name to all modules
This adds the module name to all PCI drivers, if they are built into the kernel or not. It will show up in /sys/modules/MODULE_NAME/drivers/ It also fixes up the IDE core, which was calling __pci_register_driver() directly. Cc: Kay Sievers <kay.sievers@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/ide/setup-pci.c7
-rw-r--r--drivers/pci/pci-driver.c4
-rw-r--r--include/linux/ide.h4
-rw-r--r--include/linux/pci.h5
4 files changed, 12 insertions, 8 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 695e23904d30..a52c80fe7d3e 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -783,10 +783,11 @@ static LIST_HEAD(ide_pci_drivers);
783 * Returns are the same as for pci_register_driver 783 * Returns are the same as for pci_register_driver
784 */ 784 */
785 785
786int __ide_pci_register_driver(struct pci_driver *driver, struct module *module) 786int __ide_pci_register_driver(struct pci_driver *driver, struct module *module,
787 const char *mod_name)
787{ 788{
788 if(!pre_init) 789 if(!pre_init)
789 return __pci_register_driver(driver, module); 790 return __pci_register_driver(driver, module, mod_name);
790 driver->driver.owner = module; 791 driver->driver.owner = module;
791 list_add_tail(&driver->node, &ide_pci_drivers); 792 list_add_tail(&driver->node, &ide_pci_drivers);
792 return 0; 793 return 0;
@@ -862,6 +863,6 @@ void __init ide_scan_pcibus (int scan_direction)
862 { 863 {
863 list_del(l); 864 list_del(l);
864 d = list_entry(l, struct pci_driver, node); 865 d = list_entry(l, struct pci_driver, node);
865 __pci_register_driver(d, d->driver.owner); 866 __pci_register_driver(d, d->driver.owner, d->driver.mod_name);
866 } 867 }
867} 868}
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 92d5e8db0de7..358766885260 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -422,7 +422,8 @@ static struct kobj_type pci_driver_kobj_type = {
422 * If no error occurred, the driver remains registered even if 422 * If no error occurred, the driver remains registered even if
423 * no device was claimed during registration. 423 * no device was claimed during registration.
424 */ 424 */
425int __pci_register_driver(struct pci_driver *drv, struct module *owner) 425int __pci_register_driver(struct pci_driver *drv, struct module *owner,
426 const char *mod_name)
426{ 427{
427 int error; 428 int error;
428 429
@@ -430,6 +431,7 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner)
430 drv->driver.name = drv->name; 431 drv->driver.name = drv->name;
431 drv->driver.bus = &pci_bus_type; 432 drv->driver.bus = &pci_bus_type;
432 drv->driver.owner = owner; 433 drv->driver.owner = owner;
434 drv->driver.mod_name = mod_name;
433 drv->driver.kobj.ktype = &pci_driver_kobj_type; 435 drv->driver.kobj.ktype = &pci_driver_kobj_type;
434 436
435 if (pci_multithread_probe) 437 if (pci_multithread_probe)
diff --git a/include/linux/ide.h b/include/linux/ide.h
index e26a03981a94..827688f41d6c 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1192,8 +1192,8 @@ void ide_init_disk(struct gendisk *, ide_drive_t *);
1192extern int ideprobe_init(void); 1192extern int ideprobe_init(void);
1193 1193
1194extern void ide_scan_pcibus(int scan_direction) __init; 1194extern void ide_scan_pcibus(int scan_direction) __init;
1195extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner); 1195extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
1196#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE) 1196#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
1197void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *); 1197void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *);
1198extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); 1198extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d);
1199 1199
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f3c617eabd8d..cb899eb95d31 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -573,10 +573,11 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
573void pci_enable_bridges(struct pci_bus *bus); 573void pci_enable_bridges(struct pci_bus *bus);
574 574
575/* Proper probing supporting hot-pluggable devices */ 575/* Proper probing supporting hot-pluggable devices */
576int __must_check __pci_register_driver(struct pci_driver *, struct module *); 576int __must_check __pci_register_driver(struct pci_driver *, struct module *,
577 const char *mod_name);
577static inline int __must_check pci_register_driver(struct pci_driver *driver) 578static inline int __must_check pci_register_driver(struct pci_driver *driver)
578{ 579{
579 return __pci_register_driver(driver, THIS_MODULE); 580 return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
580} 581}
581 582
582void pci_unregister_driver(struct pci_driver *); 583void pci_unregister_driver(struct pci_driver *);