[PATCH] PCI: automatically set device_driver.owner
A nice feature of sysfs is that it can create the symlink from the driver to the module that is contained in it. It requires that the device_driver.owner is set, what is not the case for many PCI drivers. This patch allows pci_register_driver to set automatically the device_driver.owner for any PCI driver. Credits to Al Viro who suggested the method. Signed-off-by: Laurent Riffard <laurent.riffard@free.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> -- drivers/ide/setup-pci.c | 12 +++++++----- drivers/pci/pci-driver.c | 9 +++++---- include/linux/ide.h | 3 ++- include/linux/pci.h | 10 ++++++++-- 4 files changed, 22 insertions(+), 12 deletions(-)
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f8eb1005a5
commit
863b18f4b5
@@ -787,8 +787,9 @@ static int pre_init = 1; /* Before first ordered IDE scan */
|
||||
static LIST_HEAD(ide_pci_drivers);
|
||||
|
||||
/*
|
||||
* ide_register_pci_driver - attach IDE driver
|
||||
* __ide_register_pci_driver - attach IDE driver
|
||||
* @driver: pci driver
|
||||
* @module: owner module of the driver
|
||||
*
|
||||
* Registers a driver with the IDE layer. The IDE layer arranges that
|
||||
* boot time setup is done in the expected device order and then
|
||||
@@ -801,15 +802,16 @@ static LIST_HEAD(ide_pci_drivers);
|
||||
* Returns are the same as for pci_register_driver
|
||||
*/
|
||||
|
||||
int ide_pci_register_driver(struct pci_driver *driver)
|
||||
int __ide_pci_register_driver(struct pci_driver *driver, struct module *module)
|
||||
{
|
||||
if(!pre_init)
|
||||
return pci_module_init(driver);
|
||||
return __pci_register_driver(driver, module);
|
||||
driver->driver.owner = module;
|
||||
list_add_tail(&driver->node, &ide_pci_drivers);
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL_GPL(ide_pci_register_driver);
|
||||
EXPORT_SYMBOL_GPL(__ide_pci_register_driver);
|
||||
|
||||
/**
|
||||
* ide_unregister_pci_driver - unregister an IDE driver
|
||||
@@ -897,6 +899,6 @@ void __init ide_scan_pcibus (int scan_direction)
|
||||
{
|
||||
list_del(l);
|
||||
d = list_entry(l, struct pci_driver, node);
|
||||
pci_register_driver(d);
|
||||
__pci_register_driver(d, d->driver.owner);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user