Skip to contentSkip to conversation

piix: Use refcounted interface when searching for a 450NX

PATCH In review Alan Cox 3 participants 4 messages Sep 15, 2006 libata

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 piix: Use refcounted interface when searching for a 450NX

Simple conversion

drivers/ide/pci/piix.c +1 -1
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.18-rc6-mm1/drivers/ide/pci/piix.c linux-2.6.18-rc6-mm1/drivers/ide/pci/piix.c
@@ -602,7 +602,7 @@
 	struct pci_dev *pdev = NULL;
 	u16 cfg;
 	u8 rev;
-	while((pdev=pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev))!=NULL)
+	while((pdev=pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev))!=NULL)
 	{
 		/* Look for 450NX PXB. Check for problem configurations
 		   A PCI quirk checks bit 6 already */
#1 lore raw

Hello.

Quoted 8 lines · Alan Cox

Simple conversion

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.18-rc6-mm1/drivers/ide/pci/piix.c linux-2.6.18-rc6-mm1/drivers/ide/pci/piix.c

drivers/ide/pci/piix.c line 608

Quoted 8 lines
drivers/ide/pci/piix.c +1 -1
@@ -602,7 +602,7 @@
 	struct pci_dev *pdev = NULL;
 	u16 cfg;
 	u8 rev;
-	while((pdev=pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev))!=NULL)
+	while((pdev=pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev))!=NULL)
 	{
 		/* Look for 450NX PXB. Check for problem configurations
 		   A PCI quirk checks bit 6 already */

Shouldn't pci_put_dev() be called after the bridge device no longer needed?
I assume it's not needed anymore after this function is finished...

WBR, Sergei

author
#2 lore raw

Ar Gwe, 2006-09-15 am 18:14 +0400, ysgrifennodd Sergei Shtylyov:

Quoted 8 lines

drivers/ide/pci/piix.c line 608

Quoted 5 lines
drivers/ide/pci/piix.c +1 -1
-	while((pdev=pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev))!=NULL)
+	while((pdev=pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev))!=NULL)
 	{
 		/* Look for 450NX PXB. Check for problem configurations
 		   A PCI quirk checks bit 6 already */

Shouldn't pci_put_dev() be called after the bridge device no longer needed?
I assume it's not needed anymore after this function is finished...

pci_get_device gets called repeatedly to walk each device. Each call drops the reference to the previous device (the one passed in).

#3 lore raw
In reply to Alan Cox
Quoted 8 lines · On Fri, 15 Sep 2006 15:14:38 +0100 Alan Cox <[email protected]> wrote:

Simple conversion

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.18-rc6-mm1/drivers/ide/pci/piix.c linux-2.6.18-rc6-mm1/drivers/ide/pci/piix.c

drivers/ide/pci/piix.c line 608

Quoted 8 lines
drivers/ide/pci/piix.c +1 -1
@@ -602,7 +602,7 @@
 	struct pci_dev *pdev = NULL;
 	u16 cfg;
 	u8 rev;
-	while((pdev=pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev))!=NULL)
+	while((pdev=pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev))!=NULL)
 	{
 		/* Look for 450NX PXB. Check for problem configurations
 		   A PCI quirk checks bit 6 already */

fwiw, I have an ad450nx server upon which I occasionally test kernels.