Commit e578f043 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by David S. Miller

stmmac: intel: Remove unnecessary loop for PCI BARs

Copy'n'paste without thinking is not a good idea and in this case it brought
unnecessary loop over PCI BAR resources which was needed to workaround one of
STMicro RVP boards. Remove unnecessary loops from Intel driver.

Fixes: 58da0cfa ("net: stmmac: create dwmac-intel.c to contain all Intel platform")
Cc: Voon Weifeng <weifeng.voon@intel.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 09f012e6
...@@ -606,7 +606,6 @@ static int intel_eth_pci_probe(struct pci_dev *pdev, ...@@ -606,7 +606,6 @@ static int intel_eth_pci_probe(struct pci_dev *pdev,
struct intel_priv_data *intel_priv; struct intel_priv_data *intel_priv;
struct plat_stmmacenet_data *plat; struct plat_stmmacenet_data *plat;
struct stmmac_resources res; struct stmmac_resources res;
int i;
int ret; int ret;
intel_priv = devm_kzalloc(&pdev->dev, sizeof(*intel_priv), intel_priv = devm_kzalloc(&pdev->dev, sizeof(*intel_priv),
...@@ -637,15 +636,9 @@ static int intel_eth_pci_probe(struct pci_dev *pdev, ...@@ -637,15 +636,9 @@ static int intel_eth_pci_probe(struct pci_dev *pdev,
return ret; return ret;
} }
/* Get the base address of device */ ret = pcim_iomap_regions(pdev, BIT(0), pci_name(pdev));
for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (ret)
if (pci_resource_len(pdev, i) == 0) return ret;
continue;
ret = pcim_iomap_regions(pdev, BIT(i), pci_name(pdev));
if (ret)
return ret;
break;
}
pci_set_master(pdev); pci_set_master(pdev);
...@@ -659,7 +652,7 @@ static int intel_eth_pci_probe(struct pci_dev *pdev, ...@@ -659,7 +652,7 @@ static int intel_eth_pci_probe(struct pci_dev *pdev,
pci_enable_msi(pdev); pci_enable_msi(pdev);
memset(&res, 0, sizeof(res)); memset(&res, 0, sizeof(res));
res.addr = pcim_iomap_table(pdev)[i]; res.addr = pcim_iomap_table(pdev)[0];
res.wol_irq = pdev->irq; res.wol_irq = pdev->irq;
res.irq = pdev->irq; res.irq = pdev->irq;
...@@ -683,19 +676,13 @@ static void intel_eth_pci_remove(struct pci_dev *pdev) ...@@ -683,19 +676,13 @@ static void intel_eth_pci_remove(struct pci_dev *pdev)
{ {
struct net_device *ndev = dev_get_drvdata(&pdev->dev); struct net_device *ndev = dev_get_drvdata(&pdev->dev);
struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_priv *priv = netdev_priv(ndev);
int i;
stmmac_dvr_remove(&pdev->dev); stmmac_dvr_remove(&pdev->dev);
clk_disable_unprepare(priv->plat->stmmac_clk); clk_disable_unprepare(priv->plat->stmmac_clk);
clk_unregister_fixed_rate(priv->plat->stmmac_clk); clk_unregister_fixed_rate(priv->plat->stmmac_clk);
for (i = 0; i < PCI_STD_NUM_BARS; i++) { pcim_iounmap_regions(pdev, BIT(0));
if (pci_resource_len(pdev, i) == 0)
continue;
pcim_iounmap_regions(pdev, BIT(i));
break;
}
pci_disable_device(pdev); pci_disable_device(pdev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment