public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Rolf Eike Beer <eike-kernel@sf-tec.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PPC] Missing pci_dev_put in arch/ppc/platforms/chrp_pci.c ?
Date: Wed, 17 Nov 2004 14:04:23 -0800	[thread overview]
Message-ID: <20041117220423.GC1291@kroah.com> (raw)
In-Reply-To: <200411171329.51687@bilbo.math.uni-mannheim.de>

On Wed, Nov 17, 2004 at 01:29:51PM +0100, Rolf Eike Beer wrote:
> This is how it is:
> 
> chrp_pcibios_fixup(void)
> {
>         struct pci_dev *dev = NULL;
>         struct device_node *np;
> 
>         /* PCI interrupts are controlled by the OpenPIC */
>         for_each_pci_dev(dev) {
>                 np = pci_device_to_OF_node(dev);
>                 if ((np != 0) && (np->n_intrs > 0) && (np->intrs[0].line != 0))
>                         dev->irq = np->intrs[0].line;
>                 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
>         }
> }
> 
> for_each_pci_dev is defined to use pci_get_device in include/linux/pci.h,
> which uses pci_dev_get. So every PCI devices use count will be incremented
> if chrp_pcibios_fixup is called. Do I miss something or should we add a
> pci_dev_put(dev) at the end of the loop?

You missed something :)

Read the docs for pci_get_device(), it will explain how the above code
is just fine.

BTW, this isn't the first time this very question has come up on lkml,
how come people never think to do a archive search...

thanks,

greg k-h

      reply	other threads:[~2004-11-17 23:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-17 12:29 [PPC] Missing pci_dev_put in arch/ppc/platforms/chrp_pci.c ? Rolf Eike Beer
2004-11-17 22:04 ` Greg KH [this message]

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=20041117220423.GC1291@kroah.com \
    --to=greg@kroah.com \
    --cc=eike-kernel@sf-tec.de \
    --cc=linux-kernel@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