Skip to contentSkip to conversation

mmc: sdhci-pci: Replace deprecated PCI functions

PATCH In review Alper Ak 3 participants 3 messages Sep 17 – Sep 29

Subsystems (2)
lore
Share & tools
lore

Alper Ak

author
#0 lore raw

PATCH 1/1 mmc: sdhci-pci: Replace deprecated PCI functions

pcim_iomap_regions() and pcim_iomap_table() have been deprecated. Replace them with pcim_iomap_region(), which requests and maps a single BAR and returns the mapping directly.

pcim_iomap_region() returns an IOMEM_ERR_PTR() on failure, so check the result with IS_ERR() and propagate the error with ERR_CAST().

---
 drivers/mmc/host/sdhci-pci-core.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +3 -5
index b121d896a804..a9000f3bd419 100644
@@ -2170,14 +2170,12 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
 
 	host->irq = pdev->irq;
 
-	ret = pcim_iomap_regions(pdev, BIT(bar), mmc_hostname(host->mmc));
-	if (ret) {
+	host->ioaddr = pcim_iomap_region(pdev, bar, mmc_hostname(host->mmc));
+	if (IS_ERR(host->ioaddr)) {
 		dev_err(&pdev->dev, "cannot request region\n");
-		return ERR_PTR(ret);
+		return ERR_CAST(host->ioaddr);
 	}
 
-	host->ioaddr = pcim_iomap_table(pdev)[bar];
-
 	if (chip->fixes && chip->fixes->probe_slot) {
 		ret = chip->fixes->probe_slot(slot);
 		if (ret)
Signature · 1 line
2.43.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Alper Ak

pcim_iomap_regions() and pcim_iomap_table() have been deprecated. Replace them with pcim_iomap_region(), which requests and maps a single BAR and returns the mapping directly.

pcim_iomap_region() returns an IOMEM_ERR_PTR() on failure, so check the result with IS_ERR() and propagate the error with ERR_CAST().

Quoted 26 lines
---
 drivers/mmc/host/sdhci-pci-core.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +3 -5
index b121d896a804..a9000f3bd419 100644
@@ -2170,14 +2170,12 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
 
 	host->irq = pdev->irq;
 
-	ret = pcim_iomap_regions(pdev, BIT(bar), mmc_hostname(host->mmc));
-	if (ret) {
+	host->ioaddr = pcim_iomap_region(pdev, bar, mmc_hostname(host->mmc));
+	if (IS_ERR(host->ioaddr)) {
 		dev_err(&pdev->dev, "cannot request region\n");
-		return ERR_PTR(ret);
+		return ERR_CAST(host->ioaddr);
 	}
 
-	host->ioaddr = pcim_iomap_table(pdev)[bar];
-
 	if (chip->fixes && chip->fixes->probe_slot) {
 		ret = chip->fixes->probe_slot(slot);
 		if (ret)
#2 lore raw
In reply to Alper Ak
Quoted 9 lines · Alper Ak

pcim_iomap_regions() and pcim_iomap_table() have been deprecated. Replace them with pcim_iomap_region(), which requests and maps a single BAR and returns the mapping directly.

pcim_iomap_region() returns an IOMEM_ERR_PTR() on failure, so check the result with IS_ERR() and propagate the error with ERR_CAST().

Applied for next, thanks!

Kind regards
Uffe

Quoted 29 lines
---
 drivers/mmc/host/sdhci-pci-core.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/mmc/host/sdhci-pci-core.c +3 -6
index b121d896a804..a9000f3bd419 100644
@@ -2170,14 +2170,12 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
 
        host->irq = pdev->irq;
 
-       ret = pcim_iomap_regions(pdev, BIT(bar), mmc_hostname(host->mmc));
-       if (ret) {
+       host->ioaddr = pcim_iomap_region(pdev, bar, mmc_hostname(host->mmc));
+       if (IS_ERR(host->ioaddr)) {
                dev_err(&pdev->dev, "cannot request region\n");
-               return ERR_PTR(ret);
+               return ERR_CAST(host->ioaddr);
        }
 
-       host->ioaddr = pcim_iomap_table(pdev)[bar];
-
        if (chip->fixes && chip->fixes->probe_slot) {
                ret = chip->fixes->probe_slot(slot);
                if (ret)
--

2.43.0