2004-10-08 22:26:54

by Hanna Linder

[permalink] [raw]
Subject: [RFT 2.6] ebus.c replace pci_find_device with pci_get_device

As pci_find_device is going away I've replaced it with pci_get_device.
If someone with a Sparc system could test it I would appreciate it.
Thanks.

Hanna Linder
IBM Linux Technology Center

Signed-off-by: Hanna Linder <[email protected]>

---
diff -Nrup linux-2.6.9-rc3-mm3cln/arch/sparc/kernel/ebus.c linux-2.6.9-rc3-mm3patch2/arch/sparc/kernel/ebus.c
--- linux-2.6.9-rc3-mm3cln/arch/sparc/kernel/ebus.c 2004-09-29 20:05:51.000000000 -0700
+++ linux-2.6.9-rc3-mm3patch2/arch/sparc/kernel/ebus.c 2004-10-08 15:17:41.481638808 -0700
@@ -275,7 +275,7 @@ void __init ebus_init(void)
}
}

- pdev = pci_find_device(PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_EBUS, 0);
+ pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_EBUS, 0);
if (!pdev) {
return;
}
@@ -342,7 +342,7 @@ void __init ebus_init(void)
}

next_ebus:
- pdev = pci_find_device(PCI_VENDOR_ID_SUN,
+ pdev = pci_get_device(PCI_VENDOR_ID_SUN,
PCI_DEVICE_ID_SUN_EBUS, pdev);
if (!pdev)
break;


2004-10-09 17:13:36

by Scott Feldman

[permalink] [raw]
Subject: Re: [KJ] [RFT 2.6] ebus.c replace pci_find_device with pci_get_device

On Fri, 2004-10-08 at 15:26, Hanna Linder wrote:
> @@ -275,7 +275,7 @@ void __init ebus_init(void)
> }
> }
>
> - pdev = pci_find_device(PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_EBUS, 0);
> + pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_EBUS, 0);
> if (!pdev) {
> return;
> }
> @@ -342,7 +342,7 @@ void __init ebus_init(void)
> }
>
> next_ebus:
> - pdev = pci_find_device(PCI_VENDOR_ID_SUN,
> + pdev = pci_get_device(PCI_VENDOR_ID_SUN,
> PCI_DEVICE_ID_SUN_EBUS, pdev);
> if (!pdev)
> break;

If we can get out of the while() with pdev != NULL, then a
pci_dev_put(pdev) cleanup is required.

-scott

2004-10-12 22:11:05

by Hanna Linder

[permalink] [raw]
Subject: Re: [KJ] [RFT 2.6] ebus.c replace pci_find_device with pci_get_device

--On Saturday, October 09, 2004 10:13:28 AM -0700 Scott Feldman <[email protected]> wrote:
> If we can get out of the while() with pdev != NULL, then a
> pci_dev_put(pdev) cleanup is required.
>
> -scott

Here is the new patch. Thanks Scott.

Signed-off-by: Hanna Linder <[email protected]>

diff -Nrup linux-2.6.9-rc4-mm1cln/arch/sparc/kernel/ebus.c linux-2.6.9-rc4-mm1patch/arch/sparc/kernel/ebus.c
--- linux-2.6.9-rc4-mm1cln/arch/sparc/kernel/ebus.c 2004-10-12 14:15:31.000000000 -0700
+++ linux-2.6.9-rc4-mm1patch/arch/sparc/kernel/ebus.c 2004-10-12 14:53:55.369254888 -0700
@@ -275,7 +275,7 @@ void __init ebus_init(void)
}
}

- pdev = pci_find_device(PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_EBUS, 0);
+ pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_EBUS, 0);
if (!pdev) {
return;
}
@@ -342,7 +342,7 @@ void __init ebus_init(void)
}

next_ebus:
- pdev = pci_find_device(PCI_VENDOR_ID_SUN,
+ pdev = pci_get_device(PCI_VENDOR_ID_SUN,
PCI_DEVICE_ID_SUN_EBUS, pdev);
if (!pdev)
break;
@@ -356,4 +356,6 @@ void __init ebus_init(void)
ebus->next = 0;
++num_ebus;
}
+ if(pdev)
+ pci_dev_put(pdev);
}