Skip to contentSkip to conversation

convert pci_find_device to pci_get_device

PATCH In review Hanna Linder 3 participants 5 messages Sep 13, 2004 – Sep 14, 2004 Alpha port

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 convert pci_find_device to pci_get_device

Here is a very simple patch to convert pci_find_device call to pci_get_device. As I don't have an alpha box or cross compiler could someone (wli- wink wink) please verify it compiles and doesn't break anything, thanks a lot.

Hanna Linder
IBM Linux Technology Center

arch/alpha/kernel/sys_sio.c +2 -2
diff -Nrup linux-2.6.9-rc1/arch/alpha/kernel/sys_sio.c linux-2.6.9-rc1-alpha/arch/alpha/kernel/sys_sio.c
@@ -105,7 +105,7 @@ sio_collect_irq_levels(void)
 	struct pci_dev *dev = NULL;
 
 	/* Iterate through the devices, collecting IRQ levels.  */
-	while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+	while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
 		if ((dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) &&
 		    (dev->class >> 8 != PCI_CLASS_BRIDGE_PCMCIA))
 			continue;
@@ -229,7 +229,7 @@ alphabook1_init_pci(void)
 	 */
 
 	dev = NULL;
-	while ((dev = pci_find_device(PCI_VENDOR_ID_NCR, PCI_ANY_ID, dev))) {
+	while ((dev = pci_get_device(PCI_VENDOR_ID_NCR, PCI_ANY_ID, dev))) {
                 if (dev->device == PCI_DEVICE_ID_NCR_53C810
 		    || dev->device == PCI_DEVICE_ID_NCR_53C815
 		    || dev->device == PCI_DEVICE_ID_NCR_53C820
#1 lore raw

Salut,

Quoted 13 lines · Hanna Linder

diff -Nrup linux-2.6.9-rc1/arch/alpha/kernel/sys_sio.c linux-2.6.9-rc1-alpha/arch/alpha/kernel/sys_sio.c

arch/alpha/kernel/sys_sio.c +1 -1
@@ -105,7 +105,7 @@ sio_collect_irq_levels(void)
 	struct pci_dev *dev = NULL;
 
 	/* Iterate through the devices, collecting IRQ levels.  */
-	while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+	while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
 		if ((dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) &&
 		    (dev->class >> 8 != PCI_CLASS_BRIDGE_PCMCIA))
 			continue;

arch/alpha/kernel/sys_sio.c alphabook1_init_pci(void) · line 235

Quoted 8 lines
arch/alpha/kernel/sys_sio.c +1 -1
@@ -229,7 +229,7 @@ alphabook1_init_pci(void)
 	 */
 
 	dev = NULL;
-	while ((dev = pci_find_device(PCI_VENDOR_ID_NCR, PCI_ANY_ID, dev))) {
+	while ((dev = pci_get_device(PCI_VENDOR_ID_NCR, PCI_ANY_ID, dev))) {
                 if (dev->device == PCI_DEVICE_ID_NCR_53C810
 		    || dev->device == PCI_DEVICE_ID_NCR_53C815
 		    || dev->device == PCI_DEVICE_ID_NCR_53C820

Don't we need to put these devices in some place?

Tonnerre

#2 lore raw
Quoted 7 lines · Tonnerre

arch/alpha/kernel/sys_sio.c alphabook1_init_pci(void) · line 235

Quoted 5 lines
arch/alpha/kernel/sys_sio.c +1 -1
-	while ((dev = pci_find_device(PCI_VENDOR_ID_NCR, PCI_ANY_ID, dev))) {
+	while ((dev = pci_get_device(PCI_VENDOR_ID_NCR, PCI_ANY_ID, dev))) {
                 if (dev->device == PCI_DEVICE_ID_NCR_53C810
 		    || dev->device == PCI_DEVICE_ID_NCR_53C815
 		    || dev->device == PCI_DEVICE_ID_NCR_53C820

Don't we need to put these devices in some place?

pci_get_device does that for non-null "from" argument.

r~

#3 lore raw

Salut,

Quoted 10 lines · Richard Henderson
Quoted 7 lines · Tonnerre

arch/alpha/kernel/sys_sio.c alphabook1_init_pci(void) · line 235

Quoted 5 lines
arch/alpha/kernel/sys_sio.c +1 -1
-	while ((dev = pci_find_device(PCI_VENDOR_ID_NCR, PCI_ANY_ID, dev))) {
+	while ((dev = pci_get_device(PCI_VENDOR_ID_NCR, PCI_ANY_ID, dev))) {
                 if (dev->device == PCI_DEVICE_ID_NCR_53C810
 		    || dev->device == PCI_DEVICE_ID_NCR_53C815
 		    || dev->device == PCI_DEVICE_ID_NCR_53C820

Don't we need to put these devices in some place?

pci_get_device does that for non-null "from" argument.

I was talking about pci_put_device(dev)..

Tonnerre

#4 lore raw
Quoted 9 lines · --On Tuesday, September 14, 2004 04:21:25 AM +0200 Tonnerre…
Quoted 4 lines · Richard Henderson
Quoted 1 line · Tonnerre

Don't we need to put these devices in some place?

pci_get_device does that for non-null "from" argument.

I was talking about pci_put_device(dev)..

Tonnerre

Hi Tonnerre,

I believe that is what Richard is talking about as well. When pci_get_device is in a while loop the dereference is done automatically. See the code and comments.

You will notice in the sys_alcor.c patch I did add the pci_dev_put (although in the wrong place, new patch coming soon).

Regards,

Hanna