Messages in this thread | | | Date | Wed, 10 Aug 2011 14:35:11 -0400 | From | "Emilio G. Cota" <> | Subject | Re: [PATCH 5/8] staging: vme: add functions for bridge module refcounting |
| |
On Wed, Aug 10, 2011 at 10:50:59 +0100, Martyn Welch wrote: > Again, in pci-driver.c: > > static int pci_device_probe(struct device * dev) > { > int error = 0; > struct pci_driver *drv; > struct pci_dev *pci_dev; > > drv = to_pci_driver(dev->driver); > pci_dev = to_pci_dev(dev); > pci_dev_get(pci_dev); > error = __pci_device_probe(drv, pci_dev); > if (error) > pci_dev_put(pci_dev); > > return error; > } > > Again, doing as Manohar suggested.
Well in fact I just realised our discussion has been completely misdirected.
I read the original patch again, and it does something different to what these _get_dev functions are doing. The patch increments the refcount of the _bridge_; the get_dev() calls increment the functions of the _device_ itself, not the bridge, which wouldn't protect the device against the bridge being removed.
The closest thing I saw in the kernel was usb_get_intf(), which is what I had in mind when I wrote the original patchset back in the day:
http://lxr.free-electrons.com/ident?i=usb_get_intf
Sorry for overlooking this (and the subsequent noise), it's been a while since then.
Emilio
| |