提交 caa8e932 编写于 作者: J Johannes Thumshirn 提交者: Bjorn Helgaas

alx: Use pci_(request|release)_mem_regions

Now that we do have pci_request_mem_regions() and pci_release_mem_regions()
at hand, use it in the ethernet drivers.
Suggested-by: NChristoph Hellwig <hch@infradead.org>
Signed-off-by: NJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
CC: Jay Cliburn <jcliburn@gmail.com>
CC: Chris Snook <chris.snook@gmail.com>
CC: David S. Miller <davem@davemloft.net>
上级 56d766d6
...@@ -1284,7 +1284,7 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1284,7 +1284,7 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
struct alx_priv *alx; struct alx_priv *alx;
struct alx_hw *hw; struct alx_hw *hw;
bool phy_configured; bool phy_configured;
int bars, err; int err;
err = pci_enable_device_mem(pdev); err = pci_enable_device_mem(pdev);
if (err) if (err)
...@@ -1304,11 +1304,10 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1304,11 +1304,10 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
} }
} }
bars = pci_select_bars(pdev, IORESOURCE_MEM); err = pci_request_mem_regions(pdev, alx_drv_name);
err = pci_request_selected_regions(pdev, bars, alx_drv_name);
if (err) { if (err) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"pci_request_selected_regions failed(bars:%d)\n", bars); "pci_request_mem_regions failed\n");
goto out_pci_disable; goto out_pci_disable;
} }
...@@ -1434,7 +1433,7 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1434,7 +1433,7 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
out_free_netdev: out_free_netdev:
free_netdev(netdev); free_netdev(netdev);
out_pci_release: out_pci_release:
pci_release_selected_regions(pdev, bars); pci_release_mem_regions(pdev);
out_pci_disable: out_pci_disable:
pci_disable_device(pdev); pci_disable_device(pdev);
return err; return err;
...@@ -1453,8 +1452,7 @@ static void alx_remove(struct pci_dev *pdev) ...@@ -1453,8 +1452,7 @@ static void alx_remove(struct pci_dev *pdev)
unregister_netdev(alx->dev); unregister_netdev(alx->dev);
iounmap(hw->hw_addr); iounmap(hw->hw_addr);
pci_release_selected_regions(pdev, pci_release_mem_regions(pdev);
pci_select_bars(pdev, IORESOURCE_MEM));
pci_disable_pcie_error_reporting(pdev); pci_disable_pcie_error_reporting(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册