Commit 725522b5 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent fe480a26
...@@ -783,10 +783,11 @@ static LIST_HEAD(ide_pci_drivers); ...@@ -783,10 +783,11 @@ static LIST_HEAD(ide_pci_drivers);
* Returns are the same as for pci_register_driver * Returns are the same as for pci_register_driver
*/ */
int __ide_pci_register_driver(struct pci_driver *driver, struct module *module) int __ide_pci_register_driver(struct pci_driver *driver, struct module *module,
const char *mod_name)
{ {
if(!pre_init) if(!pre_init)
return __pci_register_driver(driver, module); return __pci_register_driver(driver, module, mod_name);
driver->driver.owner = module; driver->driver.owner = module;
list_add_tail(&driver->node, &ide_pci_drivers); list_add_tail(&driver->node, &ide_pci_drivers);
return 0; return 0;
...@@ -862,6 +863,6 @@ void __init ide_scan_pcibus (int scan_direction) ...@@ -862,6 +863,6 @@ void __init ide_scan_pcibus (int scan_direction)
{ {
list_del(l); list_del(l);
d = list_entry(l, struct pci_driver, node); d = list_entry(l, struct pci_driver, node);
__pci_register_driver(d, d->driver.owner); __pci_register_driver(d, d->driver.owner, d->driver.mod_name);
} }
} }
...@@ -422,7 +422,8 @@ static struct kobj_type pci_driver_kobj_type = { ...@@ -422,7 +422,8 @@ static struct kobj_type pci_driver_kobj_type = {
* If no error occurred, the driver remains registered even if * If no error occurred, the driver remains registered even if
* no device was claimed during registration. * no device was claimed during registration.
*/ */
int __pci_register_driver(struct pci_driver *drv, struct module *owner) int __pci_register_driver(struct pci_driver *drv, struct module *owner,
const char *mod_name)
{ {
int error; int error;
...@@ -430,6 +431,7 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner) ...@@ -430,6 +431,7 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner)
drv->driver.name = drv->name; drv->driver.name = drv->name;
drv->driver.bus = &pci_bus_type; drv->driver.bus = &pci_bus_type;
drv->driver.owner = owner; drv->driver.owner = owner;
drv->driver.mod_name = mod_name;
drv->driver.kobj.ktype = &pci_driver_kobj_type; drv->driver.kobj.ktype = &pci_driver_kobj_type;
if (pci_multithread_probe) if (pci_multithread_probe)
......
...@@ -1192,8 +1192,8 @@ void ide_init_disk(struct gendisk *, ide_drive_t *); ...@@ -1192,8 +1192,8 @@ void ide_init_disk(struct gendisk *, ide_drive_t *);
extern int ideprobe_init(void); extern int ideprobe_init(void);
extern void ide_scan_pcibus(int scan_direction) __init; extern void ide_scan_pcibus(int scan_direction) __init;
extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner); extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE) #define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *); void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *);
extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d);
......
...@@ -573,10 +573,11 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus, ...@@ -573,10 +573,11 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
void pci_enable_bridges(struct pci_bus *bus); void pci_enable_bridges(struct pci_bus *bus);
/* Proper probing supporting hot-pluggable devices */ /* Proper probing supporting hot-pluggable devices */
int __must_check __pci_register_driver(struct pci_driver *, struct module *); int __must_check __pci_register_driver(struct pci_driver *, struct module *,
const char *mod_name);
static inline int __must_check pci_register_driver(struct pci_driver *driver) static inline int __must_check pci_register_driver(struct pci_driver *driver)
{ {
return __pci_register_driver(driver, THIS_MODULE); return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
} }
void pci_unregister_driver(struct pci_driver *); void pci_unregister_driver(struct pci_driver *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment