All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] question about pci_dev_put
@ 2006-05-17 23:16 trem
  2006-05-18  1:20 ` Nishanth Aravamudan
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: trem @ 2006-05-17 23:16 UTC (permalink / raw)
  To: kernel-janitors

Hi

I'm looking for information about pci_get_device and pci_dev_put. If my
research are good,
I've understood that pci_get_device increment the counter of the device
returned, and it also
decremented the counter of the device given as "from".

I've searched example in the source. I've found this one in
arch/ppc/platforms/85xx/mpc85xx_cds_common.c(git kernel) :

    if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
                                        PCI_DEVICE_ID_VIA_82C586_2,
NULL))) {
                dev->irq = 10;
                pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 10);
        pci_dev_put(dev);
        }

    if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
                                        PCI_DEVICE_ID_VIA_82C586_2, dev))) {
                dev->irq = 11;
                pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 11);
        pci_dev_put(dev);
        }

So, if I don't mistake, this code is buggy, the counter is decremented
twice in the second if.
One in the pci_get_device and one in pci_dev_put. I'm on the right way ?

thanks,
trem

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

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

end of thread, other threads:[~2006-05-18 17:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-17 23:16 [KJ] question about pci_dev_put trem
2006-05-18  1:20 ` Nishanth Aravamudan
2006-05-18  1:43 ` Mark Hollomon
2006-05-18  2:00 ` Nishanth Aravamudan
2006-05-18  2:47 ` Matthew Wilcox
2006-05-18  3:39 ` Nishanth Aravamudan
2006-05-18 11:59 ` Matthew Wilcox
2006-05-18 12:57 ` Mark Hollomon
2006-05-18 17:36 ` Greg KH
2006-05-18 17:37 ` 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.