[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <14385191E87B904DBD836449AA30269D580AF2@MORGANITE.micrel.com>
Date: Tue, 19 Jan 2010 16:12:04 -0800
From: "Ha, Tristram" <Tristram.Ha@...rel.Com>
To: "Alan Cox" <alan@...rguk.ukuu.org.uk>
Cc: "Dave Miller" <davem@...emloft.net>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 2.6.33 1/3] net: Micrel KSZ8841/2 PCI Ethernet driver
Alan Cox wrote:
>>> If you make a private copy of pdev in your struct you should
>>> refcount
>> it and use
>>> pci_dev_get/pci_dev_put when you take and release the reference.
>
>> I do not understand how pci_dev_get/pci_dev_put work. Does the pdev
>> pointer actually change during the lifetime of the PCI driver?
>
> No but it can go away if the device is removed. The pci_dev_get
ensures it won't go away while
> you have a pointer to it. and the pci_dev_put gives up your reference.
>
If the PCI device is removed, like physically removing the card,
shouldn't the kernel also close the network device assocated with the
PCI device? The driver does actually cleanup the network devices and
free all memory when the pci remove function is called.
>From the PCI network drivers included in the kernel I found most drivers
use pci_dev_put only on devices that are outside their own PCI devices,
retrieved from the pci_get_device call. (They never call pci_dev_get.)
That makes sense as those PCI devices are outside PCI driver control.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists