Skip to content

Commit

Permalink
ARM: Convert to devm_ioremap_resource()
Browse files Browse the repository at this point in the history
Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Thierry Reding authored and Greg Kroah-Hartman committed Jan 25, 2013
1 parent 84dbf80 commit 5857bd9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
8 changes: 3 additions & 5 deletions arch/arm/mach-omap2/gpmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,11 +1134,9 @@ static int gpmc_probe(struct platform_device *pdev)
phys_base = res->start;
mem_size = resource_size(res);

gpmc_base = devm_request_and_ioremap(&pdev->dev, res);
if (!gpmc_base) {
dev_err(&pdev->dev, "error: request memory / ioremap\n");
return -EADDRNOTAVAIL;
}
gpmc_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(gpmc_base))
return PTR_ERR(gpmc_base);

res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res == NULL)
Expand Down
8 changes: 3 additions & 5 deletions arch/arm/mach-tegra/tegra2_emc.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,9 @@ static int tegra_emc_probe(struct platform_device *pdev)
return -ENOMEM;
}

emc_regbase = devm_request_and_ioremap(&pdev->dev, res);
if (!emc_regbase) {
dev_err(&pdev->dev, "failed to remap registers\n");
return -ENOMEM;
}
emc_regbase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(emc_regbase))
return PTR_ERR(emc_regbase);

pdata = pdev->dev.platform_data;

Expand Down
8 changes: 3 additions & 5 deletions arch/arm/plat-omap/dmtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,11 +808,9 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
return -ENOMEM;
}

timer->io_base = devm_request_and_ioremap(dev, mem);
if (!timer->io_base) {
dev_err(dev, "%s: region already claimed.\n", __func__);
return -ENOMEM;
}
timer->io_base = devm_ioremap_resource(dev, mem);
if (IS_ERR(timer->io_base))
return PTR_ERR(timer->io_base);

if (dev->of_node) {
if (of_find_property(dev->of_node, "ti,timer-alwon", NULL))
Expand Down
8 changes: 3 additions & 5 deletions arch/arm/plat-samsung/adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,9 @@ static int s3c_adc_probe(struct platform_device *pdev)
return -ENXIO;
}

adc->regs = devm_request_and_ioremap(dev, regs);
if (!adc->regs) {
dev_err(dev, "failed to map registers\n");
return -ENXIO;
}
adc->regs = devm_ioremap_resource(dev, regs);
if (IS_ERR(adc->regs))
return PTR_ERR(adc->regs);

ret = regulator_enable(adc->vdd);
if (ret)
Expand Down

0 comments on commit 5857bd9

Please sign in to comment.