Re: [patch] PCI device matching fix

From: Kai Germaschewski (kai-germaschewski@uiowa.edu)
Date: Mon Jun 10 2002 - 09:39:44 EST


On Mon, 10 Jun 2002, Patrick Mochel wrote:

> > And, you need to set the owner from the module which you want to protect.
> >
> > So in the your driver:
> >
> > struct pci_driver my_drv {
> > probe: ...
> > driver : {
> > owner: THIS_MODULE,
> > }
> > }
>
> This is certainly not the prettiest, and I've run into it when setting
> other generic driver fields. Is there a cleaner way to do this?

Depends on your definition of clean ;) The only thing I can think of is
adding some new macro which hides it. Which is still ugly. Or, of course,
unnamed struct members, which however I think is not supported by gcc < 3.
It may be something to think about.

> pci_register_driver() doesn't inc the refcount. The refcount is held at 1
> by the module loading code, IIUC, until module_init() is done. After that,
> the refcount stays at 0 until someone uses it.

Sounds okay. Well, I'm generally lost in too many patches, if you put
the whole thing onto bkbits.net or so, I'll try to give it a look.

--Kai

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jun 15 2002 - 22:00:18 EST