[7/9] gpio: htc-egpio: use devm_platform_ioremap_resource_nocache()
diff mbox series

Message ID 20190829143742.24726-8-brgl@bgdev.pl
State New
Headers show
Series
  • drivers: add new variants of devm_platform_ioremap_resource()
Related show

Commit Message

Bartosz Golaszewski Aug. 29, 2019, 2:37 p.m. UTC
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Use the new devm_platform_ioremap_resource_nocache() helper for memory
range mapping instead of devm_ioremap_nocache() combined with a call to
platform_get_resource().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/gpio/gpio-htc-egpio.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Patch
diff mbox series

diff --git a/drivers/gpio/gpio-htc-egpio.c b/drivers/gpio/gpio-htc-egpio.c
index 9d3ac51a765c..7d8548e03226 100644
--- a/drivers/gpio/gpio-htc-egpio.c
+++ b/drivers/gpio/gpio-htc-egpio.c
@@ -295,14 +295,13 @@  static int __init egpio_probe(struct platform_device *pdev)
 		ei->chained_irq = res->start;
 
 	/* Map egpio chip into virtual address space. */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
+	ei->base_addr = devm_platform_ioremap_resource_nocache(pdev, 0);
+	if (IS_ERR(ei->base_addr)) {
+		ret = PTR_ERR(ei->base_addr);
 		goto fail;
-	ei->base_addr = devm_ioremap_nocache(&pdev->dev, res->start,
-					     resource_size(res));
-	if (!ei->base_addr)
-		goto fail;
-	pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr);
+	}
+	pr_debug("EGPIO phys=%08x virt=%p\n",
+		 virt_to_phys(ei->base_addr), ei->base_addr);
 
 	if ((pdata->bus_width != 16) && (pdata->bus_width != 32))
 		goto fail;