All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] pci_dev_put related?
@ 2007-02-08  9:15 Surya
  2007-02-09  0:59 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Surya @ 2007-02-08  9:15 UTC (permalink / raw)
  To: kernel-janitors

Hi,
   I am trying to replace all the pci_find_device references with
pci_get_device and pci_dev_put(for usage decrement).

I got stuck in the file linux-2.6/drivers/ide/pci/hpt366.c

In the function init_setup_hpt366 I am not sure where I can call
pci_dev_put to decrement the usage count.

--------------snip----------------
        pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin1);
//while ((findev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID,findev)) !NULL) {
while (( findev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID,findev)) !NULL) {
                if ((findev->vendor = dev->vendor) &&
                    (findev->device = dev->device) &&
                    ((findev->devfn - dev->devfn) = 1) &&
                    (PCI_FUNC(findev->devfn) & 1)) {
                        pci_read_config_byte(findev, PCI_INTERRUPT_PIN,
&pin2);
                        if ((pin1 != pin2) && (dev->irq = findev->irq))
{
                                d->bootable = ON_BOARD;
                                printk("%s: onboard version of chipset,
"
                                        "pin1=%d pin2=%d\n", d->name,
                                        pin1, pin2);
                        }

// I dont think I can call it here because of the return
                        return ide_setup_pci_devices(dev, findev, d);
                }
        }
init_single:
        return ide_setup_pci_device(dev, d);
}


----------------snip --------------------

-spn.
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [KJ] pci_dev_put related?
  2007-02-08  9:15 [KJ] pci_dev_put related? Surya
@ 2007-02-09  0:59 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2007-02-09  0:59 UTC (permalink / raw)
  To: kernel-janitors

On Thu, Feb 08, 2007 at 02:33:39PM +0530, Surya wrote:
> Hi,
>    I am trying to replace all the pci_find_device references with
> pci_get_device and pci_dev_put(for usage decrement).
> 
> I got stuck in the file linux-2.6/drivers/ide/pci/hpt366.c
> 
> In the function init_setup_hpt366 I am not sure where I can call
> pci_dev_put to decrement the usage count.
> 
> --------------snip----------------
>         pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin1);
> //while ((findev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID,findev)) !> NULL) {
> while (( findev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID,findev)) !> NULL) {
>                 if ((findev->vendor = dev->vendor) &&
>                     (findev->device = dev->device) &&
>                     ((findev->devfn - dev->devfn) = 1) &&
>                     (PCI_FUNC(findev->devfn) & 1)) {
>                         pci_read_config_byte(findev, PCI_INTERRUPT_PIN,
> &pin2);
>                         if ((pin1 != pin2) && (dev->irq = findev->irq))
> {
>                                 d->bootable = ON_BOARD;
>                                 printk("%s: onboard version of chipset,
> "
>                                         "pin1=%d pin2=%d\n", d->name,
>                                         pin1, pin2);
>                         }
> 
> // I dont think I can call it here because of the return
>                         return ide_setup_pci_devices(dev, findev, d);

No, because you are using the pci device in that function.  You need to
do it after you are finished with the pointer, and that might be much
later...

good luck,

greg k-h
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-09  0:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-08  9:15 [KJ] pci_dev_put related? Surya
2007-02-09  0:59 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.