tile/PCI: use for_each_pci_dev to simplify the code
Wei Yongjun [Mon, 3 Dec 2012 13:28:36 +0000 (08:28 -0500)]
Use for_each_pci_dev to simplify the code.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>

arch/tile/kernel/pci.c

index 7598226..aac1cd5 100644 (file)
@@ -245,7 +245,7 @@ static void __devinit fixup_read_and_payload_sizes(void)
        u16 new_values;
 
        /* Scan for the smallest maximum payload size. */
-       while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+       for_each_pci_dev(dev) {
                u32 devcap;
                int max_payload;
 
@@ -260,7 +260,7 @@ static void __devinit fixup_read_and_payload_sizes(void)
 
        /* Now, set the max_payload_size for all devices to that value. */
        new_values = (max_read_size << 12) | (smallest_max_payload << 5);
-       while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL)
+       for_each_pci_dev(dev)
                pcie_capability_clear_and_set_word(dev, PCI_EXP_DEVCTL,
                                PCI_EXP_DEVCTL_PAYLOAD | PCI_EXP_DEVCTL_READRQ,
                                new_values);