From patchwork Fri Jan 25 14:50:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: mtd: physmap: Convert to devm_ioremap_resource() Date: Fri, 25 Jan 2013 04:50:26 -0000 From: Ezequiel Garcia X-Patchwork-Id: 215762 Message-Id: <1359125428-23801-1-git-send-email-ezequiel.garcia@free-electrons.com> To: Cc: thierry.reding@avionic-design.de, dwmw2@infradead.org, Ezequiel Garcia , Artem Bityutskiy devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths. Tested by compilation only. Signed-off-by: Ezequiel Garcia --- I can't test this patch for the moment. If anyone can give it a try and add its Tested-by, it'll be appreciated. Depends on: https://patchwork.kernel.org/patch/2010191/ drivers/mtd/maps/physmap.c | 21 +++++++-------------- 1 files changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 21b0b71..7ca1ae9 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c @@ -20,6 +20,7 @@ #include #include #include +#include #define MAX_RESOURCES 4 @@ -126,19 +127,19 @@ static int physmap_flash_probe(struct platform_device *dev) platform_set_drvdata(dev, info); for (i = 0; i < dev->num_resources; i++) { + void __iomem *virt; + printk(KERN_NOTICE "physmap platform flash device: %.8llx at %.8llx\n", (unsigned long long)resource_size(&dev->resource[i]), (unsigned long long)dev->resource[i].start); - if (!devm_request_mem_region(&dev->dev, - dev->resource[i].start, - resource_size(&dev->resource[i]), - dev_name(&dev->dev))) { - dev_err(&dev->dev, "Could not reserve memory region\n"); - err = -ENOMEM; + virt = devm_ioremap_resource(&dev->dev, &dev->resource[i]); + if (IS_ERR(virt)) { + err = PTR_ERR(virt); goto err_out; } + info->map[i].virt = virt; info->map[i].name = dev_name(&dev->dev); info->map[i].phys = dev->resource[i].start; info->map[i].size = resource_size(&dev->resource[i]); @@ -147,14 +148,6 @@ static int physmap_flash_probe(struct platform_device *dev) info->map[i].pfow_base = physmap_data->pfow_base; info->map[i].map_priv_1 = (unsigned long)dev; - info->map[i].virt = devm_ioremap(&dev->dev, info->map[i].phys, - info->map[i].size); - if (info->map[i].virt == NULL) { - dev_err(&dev->dev, "Failed to ioremap flash region\n"); - err = -EIO; - goto err_out; - } - simple_map_init(&info->map[i]); probe_type = rom_probe_types;