ixgbe: fix use of list_for_each in ixgbe_enumerate_functions
[firefly-linux-kernel-4.4.55.git] / drivers / net / ethernet / intel / ixgbe / ixgbe_main.c
index 9aa9d0ba6d3e6cc36e31969f00160e6d427ecb2a..4268a894ad2d2691bf499e766a69b98b01067414 100644 (file)
@@ -7973,23 +7973,20 @@ static const struct net_device_ops ixgbe_netdev_ops = {
  **/
 static inline int ixgbe_enumerate_functions(struct ixgbe_adapter *adapter)
 {
-       struct list_head *entry;
+       struct pci_dev *entry;
        int physfns = 0;
 
        /* Some cards can not use the generic count PCIe functions method,
         * because they are behind a parent switch, so we hardcode these with
         * the correct number of functions.
         */
-       if (ixgbe_pcie_from_parent(&adapter->hw)) {
+       if (ixgbe_pcie_from_parent(&adapter->hw))
                physfns = 4;
-       } else {
-               list_for_each(entry, &adapter->pdev->bus_list) {
-                       struct pci_dev *pdev =
-                               list_entry(entry, struct pci_dev, bus_list);
-                       /* don't count virtual functions */
-                       if (!pdev->is_virtfn)
-                               physfns++;
-               }
+
+       list_for_each_entry(entry, &adapter->pdev->bus->devices, bus_list) {
+               /* don't count virtual functions */
+               if (!entry->is_virtfn)
+                       physfns++;
        }
 
        return physfns;