From 08a137b7170514226e158c3336df7bddcde2f69b Mon Sep 17 00:00:00 2001 From: Bjørn Mork Date: Mon, 26 Oct 2015 15:41:15 +0100 Subject: mwlwifi: convert to pcim managed resource api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bjørn Mork --- main.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/main.c b/main.c index 7536039..2a9a67d 100644 --- a/main.c +++ b/main.c @@ -148,31 +148,21 @@ static const struct ieee80211_iface_combination ap_if_comb = { static int mwl_alloc_pci_resource(struct mwl_priv *priv) { struct pci_dev *pdev = priv->pdev; - void __iomem *addr; priv->next_bar_num = 1; /* 32-bit */ if (pci_resource_flags(pdev, 0) & 0x04) priv->next_bar_num = 2; /* 64-bit */ - addr = devm_ioremap_resource(&pdev->dev, &pdev->resource[0]); - if (IS_ERR(addr)) { + if (pcim_iomap_regions(pdev, BIT(0)|BIT(priv->next_bar_num), MWL_DRV_NAME) < 0) { wiphy_err(priv->hw->wiphy, - "%s: cannot reserve PCI memory region 0\n", - MWL_DRV_NAME); + "%s: cannot reserve PCI memory region 0\n", + MWL_DRV_NAME); goto err; - } - priv->iobase0 = addr; - wiphy_debug(priv->hw->wiphy, "priv->iobase0 = %p\n", priv->iobase0); + } - addr = devm_ioremap_resource(&pdev->dev, - &pdev->resource[priv->next_bar_num]); - if (IS_ERR(addr)) { - wiphy_err(priv->hw->wiphy, - "%s: cannot reserve PCI memory region 1\n", - MWL_DRV_NAME); - goto err; - } - priv->iobase1 = addr; + priv->iobase0 = pcim_iomap_table(pdev)[0]; + wiphy_debug(priv->hw->wiphy, "priv->iobase0 = %p\n", priv->iobase0); + priv->iobase1 = pcim_iomap_table(pdev)[priv->next_bar_num]; wiphy_debug(priv->hw->wiphy, "priv->iobase1 = %p\n", priv->iobase1); priv->pcmd_buf = -- cgit v1.2.3