[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110815184907.GB22239@flamenco.cs.columbia.edu>
Date: Mon, 15 Aug 2011 14:49:07 -0400
From: "Emilio G. Cota" <cota@...ap.org>
To: martyn.welch@...com, gregkh@...e.de, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/5] staging: vme: add functions for bridge module
refcounting
On Mon, Aug 15, 2011 at 12:05:03 +0200, Manohar Vanga wrote:
> > If the driver doesn't provide a .probe, we would still increment
> > the refcount of the bridge module. Is that reasonable? I dunno.
(snip)
> I picked this default behaviour from the PCI driver code (drivers/pci/pci-driver.c):
>
> static int pci_device_probe(struct device * dev)
> {
> ...
> pci_dev_get(pci_dev);
> error = __pci_device_probe(drv, pci_dev);
> if (error)
> pci_dev_put(pci_dev);
>
> return error;
> }
>
> The __pci_device_probe() function checks if probe is present or not.
There is a subtle difference here; pci_dev is the _struct pci_device
of the device_ being probed, and pci_dev_get increments its refcount.
In our case vme_bridge_get increments the refcount of the _bridge's
module_; my concern was that if there was no .probe (which would
only happen with a few special drivers), we'd increment the refcount
of the bridge for perhaps no reason.
Anyway we don't have such esoteric drivers yet, so I wouldn't worry
about this too much.
Emilio
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists