[PATCH 7/9] gpio: htc-egpio: use devm_platform_ioremap_resource_nocache()
From: Bartosz Golaszewski
Date: Thu Aug 29 2019 - 10:38:16 EST
From: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
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@xxxxxxxxxxxx>
---
drivers/gpio/gpio-htc-egpio.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
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;
--
2.21.0