Re: pci_get_device_reverse(), why does Calgary need this?

From: Greg KH
Date: Wed Feb 13 2008 - 12:35:26 EST


On Wed, Feb 13, 2008 at 11:32:26AM +0200, Muli Ben-Yehuda wrote:
> On Tue, Feb 12, 2008 at 04:16:38PM -0800, Greg KH wrote:
>
> > Why does the calgary driver need this? Can we just use
> > pci_get_device() instead? Why do you need to walk the device list
> > backwards? Do you get false positives going forward?
>
> It's not strictly needed, we used it for symmetry.

symetry for what? Ah, unwinding from an error condition, that makes
sense.

Is there some reason you aren't using the "real" PCI driver api here and
registering a pci driver for these devices? That would take the whole
"loop over all pci devices" logic out of the code entirely.

> Feel free to nuke it and walk the list forward.

So something like the patch below would be fine?

thanks,

greg k-h

---
arch/x86/kernel/pci-calgary_64.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -1232,8 +1232,7 @@ static int __init calgary_init(void)

error:
do {
- dev = pci_get_device_reverse(PCI_VENDOR_ID_IBM,
- PCI_ANY_ID, dev);
+ dev = pci_get_device(PCI_VENDOR_ID_IBM, PCI_ANY_ID, dev);
if (!dev)
break;
if (!is_cal_pci_dev(dev->device))
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/