linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ha, Tristram" <Tristram.Ha@Micrel.Com>
To: "Alan Cox" <alan@lxorguk.ukuu.org.uk>
Cc: "Dave Miller" <davem@davemloft.net>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 2.6.33 1/3] net: Micrel KSZ8841/2 PCI Ethernet driver
Date: Tue, 19 Jan 2010 16:12:04 -0800	[thread overview]
Message-ID: <14385191E87B904DBD836449AA30269D580AF2@MORGANITE.micrel.com> (raw)
In-Reply-To: <20100119213214.024b7794@lxorguk.ukuu.org.uk>

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.

  reply	other threads:[~2010-01-20  0:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-16  2:57 [PATCH 2.6.33 1/3] net: Micrel KSZ8841/2 PCI Ethernet driver Ha, Tristram
2010-01-16  9:20 ` David Miller
2010-01-19 20:03   ` Ha, Tristram
2010-01-19 21:40     ` Stephen Hemminger
2010-01-19 23:48       ` Ha, Tristram
2010-01-20  0:11         ` Stephen Hemminger
2010-01-20  0:34           ` Ha, Tristram
2010-01-20  0:50             ` Stephen Hemminger
2010-01-16 14:50 ` Alan Cox
2010-01-19 21:22   ` Ha, Tristram
2010-01-19 21:32     ` Alan Cox
2010-01-20  0:12       ` Ha, Tristram [this message]
2010-01-16 16:00 ` Michał Mirosław
2010-01-16 16:16   ` Felix Fietkau
2010-01-19 21:51     ` Ha, Tristram
2010-01-19 22:11       ` Felix Fietkau
2010-02-08 21:36 Ha, Tristram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14385191E87B904DBD836449AA30269D580AF2@MORGANITE.micrel.com \
    --to=tristram.ha@micrel.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).