[PATCH 5/8] staging: vme: add functions for bridge module refcounting

Greg KH greg at kroah.com
Mon Aug 8 18:04:00 UTC 2011


On Mon, Aug 08, 2011 at 01:22:16PM -0400, Emilio G. Cota wrote:
> On Mon, Aug 08, 2011 at 12:06:37 +0100, Martyn Welch wrote:
> > On 08/08/11 11:11, Emilio G. Cota wrote:
> > > On Mon, Aug 08, 2011 at 10:26:50 +0100, Martyn Welch wrote:
> > >> On 08/08/11 10:14, Emilio G. Cota wrote:
> > >>> Martyn, no one in the kernel is doing what you propose, for
> > >>> good reason. Look at USB, PCI, RapidIO.  They all provide get
> > >>> and put functions to be called from probe and release.
> > >>
> > >> Really, which functions are these for PCI?
> > > 
> > > pci_get_dev/put in drivers/pci/pci-driver.c.
> > > 
> > 
> > Which isn't explicitly used by the vast majority of PCI drivers. In fact the
> > instances which I did find where this was used by a PCI device driver, it
> > appears to be using the old-style PCI probing.
> 
> > This is taken care of automatically for drivers using the "newer" PCI driver
> > registration model as part of the probe.

All PCI drivers are using that model, it is not "new" at all (5+ years
old now.)

The fact is, if you grab a pointer to a device, and save it somewhere,
you HAVE TO grab a reference to that object at the same time.

To not do so is a bug, and must be fixed.

It's that simple.

greg k-h



More information about the devel mailing list