1 From 5c461327aca8975276d2480ddf02b6c7f0a29548 Mon Sep 17 00:00:00 2001
2 From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
3 Date: Wed, 17 Apr 2013 13:38:10 -0300
4 Subject: [PATCH 102/203] mtd: nand: pxa3xx: Use devm_ioremap_resource
6 Using the new devm_ioremap_resource() we can greatly
7 simplify resource handling.
9 Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
10 Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
13 drivers/mtd/nand/pxa3xx_nand.c | 31 ++++---------------------------
14 1 file changed, 4 insertions(+), 27 deletions(-)
16 --- a/drivers/mtd/nand/pxa3xx_nand.c
17 +++ b/drivers/mtd/nand/pxa3xx_nand.c
18 @@ -1108,30 +1108,16 @@ static int alloc_nand_resource(struct pl
21 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
23 - dev_err(&pdev->dev, "no IO memory resource defined\n");
25 + info->mmio_base = devm_ioremap_resource(&pdev->dev, r);
26 + if (IS_ERR(info->mmio_base)) {
27 + ret = PTR_ERR(info->mmio_base);
31 - r = request_mem_region(r->start, resource_size(r), pdev->name);
33 - dev_err(&pdev->dev, "failed to request memory resource\n");
38 - info->mmio_base = ioremap(r->start, resource_size(r));
39 - if (info->mmio_base == NULL) {
40 - dev_err(&pdev->dev, "ioremap() failed\n");
44 info->mmio_phys = r->start;
46 ret = pxa3xx_nand_init_buff(info);
51 /* initialize all interrupts to be disabled */
52 disable_int(info, NDSR_MASK);
53 @@ -1155,10 +1141,6 @@ fail_free_buf:
54 info->data_buff, info->data_buff_phys);
56 kfree(info->data_buff);
58 - iounmap(info->mmio_base);
60 - release_mem_region(r->start, resource_size(r));
62 clk_disable(info->clk);
64 @@ -1169,7 +1151,6 @@ static int pxa3xx_nand_remove(struct pla
66 struct pxa3xx_nand_info *info = platform_get_drvdata(pdev);
67 struct pxa3xx_nand_platform_data *pdata;
72 @@ -1188,10 +1169,6 @@ static int pxa3xx_nand_remove(struct pla
74 kfree(info->data_buff);
76 - iounmap(info->mmio_base);
77 - r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
78 - release_mem_region(r->start, resource_size(r));
80 clk_disable(info->clk);