This patch updates .owner field of struct pci_driver.
This allows SYSFS to create the symlink from the driver to the
module which provides it.
Signed-off-by: Laurent Riffard <[email protected]>
--
drivers/block/DAC960.c | 1 +
drivers/block/cciss.c | 1 +
drivers/block/cpqarray.c | 1 +
drivers/block/sx8.c | 1 +
drivers/block/umem.c | 1 +
5 files changed, 5 insertions(+)
Index: linux-2.6-stable/drivers/block/DAC960.c
===================================================================
--- linux-2.6-stable.orig/drivers/block/DAC960.c
+++ linux-2.6-stable/drivers/block/DAC960.c
@@ -7185,6 +7185,7 @@
MODULE_DEVICE_TABLE(pci, DAC960_id_table);
static struct pci_driver DAC960_pci_driver = {
+ .owner = THIS_MODULE,
.name = "DAC960",
.id_table = DAC960_id_table,
.probe = DAC960_Probe,
Index: linux-2.6-stable/drivers/block/cciss.c
===================================================================
--- linux-2.6-stable.orig/drivers/block/cciss.c
+++ linux-2.6-stable/drivers/block/cciss.c
@@ -2929,6 +2929,7 @@
}
static struct pci_driver cciss_pci_driver = {
+ .owner = THIS_MODULE,
.name = "cciss",
.probe = cciss_init_one,
.remove = __devexit_p(cciss_remove_one),
Index: linux-2.6-stable/drivers/block/cpqarray.c
===================================================================
--- linux-2.6-stable.orig/drivers/block/cpqarray.c
+++ linux-2.6-stable/drivers/block/cpqarray.c
@@ -541,6 +541,7 @@
}
static struct pci_driver cpqarray_pci_driver = {
+ .owner = THIS_MODULE,
.name = "cpqarray",
.probe = cpqarray_init_one,
.remove = __devexit_p(cpqarray_remove_one_pci),
Index: linux-2.6-stable/drivers/block/sx8.c
===================================================================
--- linux-2.6-stable.orig/drivers/block/sx8.c
+++ linux-2.6-stable/drivers/block/sx8.c
@@ -395,6 +395,7 @@
MODULE_DEVICE_TABLE(pci, carm_pci_tbl);
static struct pci_driver carm_driver = {
+ .owner = THIS_MODULE,
.name = DRV_NAME,
.id_table = carm_pci_tbl,
.probe = carm_init_one,
Index: linux-2.6-stable/drivers/block/umem.c
===================================================================
--- linux-2.6-stable.orig/drivers/block/umem.c
+++ linux-2.6-stable/drivers/block/umem.c
@@ -1170,6 +1170,7 @@
MODULE_DEVICE_TABLE(pci, mm_pci_ids);
static struct pci_driver mm_pci_driver = {
+ .owner = THIS_MODULE,
.name = "umem",
.id_table = mm_pci_ids,
.probe = mm_pci_probe,
--
On Sun, Oct 23, 2005 at 10:49:48PM +0200, Laurent Riffard wrote:
> This patch updates .owner field of struct pci_driver.
>
> This allows SYSFS to create the symlink from the driver to the
> module which provides it.
>
> Signed-off-by: Laurent Riffard <[email protected]>
Wouldn't it be better to eliminate pci_driver's .owner field and
set the generic device driver's owner field directly? (and fix
the PCI code not to overwrite that if pci_driver's .owner field
is NULL for compatibility.)
I ask for the second time recently on linux-kernel. Is there
*really* any point in duplicating these fields?
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
On Sun, Oct 23, 2005 at 10:13:20PM +0100, Russell King wrote:
> On Sun, Oct 23, 2005 at 10:49:48PM +0200, Laurent Riffard wrote:
> > This patch updates .owner field of struct pci_driver.
> >
> > This allows SYSFS to create the symlink from the driver to the
> > module which provides it.
> >
> > Signed-off-by: Laurent Riffard <[email protected]>
>
> Wouldn't it be better to eliminate pci_driver's .owner field and
> set the generic device driver's owner field directly? (and fix
> the PCI code not to overwrite that if pci_driver's .owner field
> is NULL for compatibility.)
>
> I ask for the second time recently on linux-kernel. Is there
> *really* any point in duplicating these fields?
#define pci_register_driver(d) __pci_register_driver(d, THIS_MODULE)
#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE)
__pci_register_driver(drv, module) - same as current pci_register_driver(),
except that instead of
drv->driver.owner = drv->owner;
it does
drv->driver.owner = module;
__ide_pci_register_driver(driver, module):
{
if(!pre_init)
return __pci_register_driver(driver, module);
driver->driver.owner = module;
list_add_tail(&driver->node, &ide_pci_drivers);
return 0;
}
and in ide_scan_pcibus() turn
pci_register_driver(d);
into
__pci_register_driver(d, d->driver.owner);
Update exports (i.e. export __pci_register_driver and __ide_pci_register_driver
instead of pci_register_driver and ide_pci_register_driver resp.).
At which point pci_driver->owner become unused and can be killed at leisure.
Objections?
On Sun, Oct 23, 2005 at 10:13:20PM +0100, Russell King wrote:
> On Sun, Oct 23, 2005 at 10:49:48PM +0200, Laurent Riffard wrote:
> > This patch updates .owner field of struct pci_driver.
> >
> > This allows SYSFS to create the symlink from the driver to the
> > module which provides it.
> >
> > Signed-off-by: Laurent Riffard <[email protected]>
>
> Wouldn't it be better to eliminate pci_driver's .owner field and
> set the generic device driver's owner field directly? (and fix
> the PCI code not to overwrite that if pci_driver's .owner field
> is NULL for compatibility.)
No there isn't, we should use the struct device .name and .owner fields
instead of the pci drivers's structure. Then we can just get rid of the
pci driver's fields too.
I just did this for the usb-serial drivers on Friday.
thanks,
greg k-h
On Sun, Oct 23, 2005 at 10:46:11PM +0100, Al Viro wrote:
> On Sun, Oct 23, 2005 at 10:13:20PM +0100, Russell King wrote:
> > On Sun, Oct 23, 2005 at 10:49:48PM +0200, Laurent Riffard wrote:
> > > This patch updates .owner field of struct pci_driver.
> > >
> > > This allows SYSFS to create the symlink from the driver to the
> > > module which provides it.
> > >
> > > Signed-off-by: Laurent Riffard <[email protected]>
> >
> > Wouldn't it be better to eliminate pci_driver's .owner field and
> > set the generic device driver's owner field directly? (and fix
> > the PCI code not to overwrite that if pci_driver's .owner field
> > is NULL for compatibility.)
> >
> > I ask for the second time recently on linux-kernel. Is there
> > *really* any point in duplicating these fields?
>
> #define pci_register_driver(d) __pci_register_driver(d, THIS_MODULE)
>
> #define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE)
>
> __pci_register_driver(drv, module) - same as current pci_register_driver(),
> except that instead of
> drv->driver.owner = drv->owner;
> it does
> drv->driver.owner = module;
>
> __ide_pci_register_driver(driver, module):
> {
> if(!pre_init)
> return __pci_register_driver(driver, module);
> driver->driver.owner = module;
> list_add_tail(&driver->node, &ide_pci_drivers);
> return 0;
> }
>
> and in ide_scan_pcibus() turn
> pci_register_driver(d);
> into
> __pci_register_driver(d, d->driver.owner);
>
> Update exports (i.e. export __pci_register_driver and __ide_pci_register_driver
> instead of pci_register_driver and ide_pci_register_driver resp.).
>
> At which point pci_driver->owner become unused and can be killed at leisure.
> Objections?
No objections at all, that's a great way to handle this.
thanks,
greg k-h