Re: [PATCH] pci_find_device --> pci_get_device

Jiri Slaby
2005-07-20T12:08:42Z

Rolf Eike Beer napsal(a):

>Am Mittwoch, 20. Juli 2005 12:40 schrieb Jiri Slaby:
>
>
>>Rolf Eike Beer napsal(a):
>>
>>
>>>Your patch to arch/sparc64/kernel/ebus.c is broken, the removed and added
>>>parts do not match in behaviour.
>>>
>>>
>>I can't still see the difference.
>>
>>
>
>diff --git a/arch/sparc64/kernel/ebus.c b/arch/sparc64/kernel/ebus.c
>--- a/arch/sparc64/kernel/ebus.c
>+++ b/arch/sparc64/kernel/ebus.c
>@@ -527,8 +527,15 @@ static struct pci_dev *find_next_ebus(st
> {
> struct pci_dev *pdev = start;
>
>- do {
>- pdev = pci_find_device(PCI_VENDOR_ID_SUN, PCI_ANY_ID, pdev);
>+ while (pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_ANY_ID, pdev))
>+ if (pdev->device == PCI_DEVICE_ID_SUN_EBUS ||
>+ pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS)
>+ break;
>+
>+ *is_rio_p = !!(pdev && (pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS));
>+
>+/* do { // BEFORE \/ AFTER ^
>+ * pdev = pci_find_device(PCI_VENDOR_ID_SUN, PCI_ANY_ID, pdev);
> if (pdev &&
> (pdev->device == PCI_DEVICE_ID_SUN_EBUS ||
> pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS))
>
>
The code was:
do {
pdev = pci_find_device(PCI_VENDOR_ID_SUN, PCI_ANY_ID, pdev);
if (pdev &&
(pdev->device == PCI_DEVICE_ID_SUN_EBUS ||
pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS))
break;
} while (pdev != NULL);

if (pdev && (pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS))
*is_rio_p = 1;
else
*is_rio_p = 0;

and I changed to:
while (pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_ANY_ID, pdev))
if (pdev->device == PCI_DEVICE_ID_SUN_EBUS ||
pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS)
break;

*is_rio_p = !!(pdev && (pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS));

Is there any difference? I don't see any, but... The reading of diff
file in this case is not the best, maybe...