Re: [PATCH 5/6] de4x5/PCI: use list_for_each_entry() for bus->devices traversal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 16, 2011 at 2:31 PM, Bjorn Helgaas <bhelgaas@xxxxxxxxxx> wrote:
> Replace open-coded list traversal with list_for_each_entry().

Hi Bjorn,

I don't have any de4x5 devices to test this but it looks correct to me.

Thanks!
grant

>
> CC: Grant Grundler <grundler@xxxxxxxxxxxxxxxx>
> CC: netdev@xxxxxxxxxxxxxxx
> Signed-off-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> ---
>  drivers/net/ethernet/dec/tulip/de4x5.c |    9 ++-------
>  1 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c
> index 871bcaa..3f5d3b9 100644
> --- a/drivers/net/ethernet/dec/tulip/de4x5.c
> +++ b/drivers/net/ethernet/dec/tulip/de4x5.c
> @@ -2127,14 +2127,9 @@ srom_search(struct net_device *dev, struct pci_dev *pdev)
>     u_long iobase = 0;                     /* Clear upper 32 bits in Alphas */
>     int i, j;
>     struct de4x5_private *lp = netdev_priv(dev);
> -    struct list_head *walk;
> -
> -    list_for_each(walk, &pdev->bus_list) {
> -       struct pci_dev *this_dev = pci_dev_b(walk);
> -
> -       /* Skip the pci_bus list entry */
> -       if (list_entry(walk, struct pci_bus, devices) == pdev->bus) continue;
> +    struct pci_dev *this_dev;
>
> +    list_for_each_entry(this_dev, &pdev->bus->devices, bus_list) {
>        vendor = this_dev->vendor;
>        device = this_dev->device << 8;
>        if (!(is_DC21040 || is_DC21041 || is_DC21140 || is_DC2114x)) continue;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux