base-files: define yes/no as valid boolean options
[openwrt/staging/lynxis/omap.git] / target / linux / mvebu / patches-3.10 / 0102-mtd-nand-pxa3xx-Use-devm_ioremap_resource.patch
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
5
6 Using the new devm_ioremap_resource() we can greatly
7 simplify resource handling.
8
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>
12 ---
13 drivers/mtd/nand/pxa3xx_nand.c | 31 ++++---------------------------
14 1 file changed, 4 insertions(+), 27 deletions(-)
15
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
19 }
20
21 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
22 - if (r == NULL) {
23 - dev_err(&pdev->dev, "no IO memory resource defined\n");
24 - ret = -ENODEV;
25 + info->mmio_base = devm_ioremap_resource(&pdev->dev, r);
26 + if (IS_ERR(info->mmio_base)) {
27 + ret = PTR_ERR(info->mmio_base);
28 goto fail_put_clk;
29 }
30 -
31 - r = request_mem_region(r->start, resource_size(r), pdev->name);
32 - if (r == NULL) {
33 - dev_err(&pdev->dev, "failed to request memory resource\n");
34 - ret = -EBUSY;
35 - goto fail_put_clk;
36 - }
37 -
38 - info->mmio_base = ioremap(r->start, resource_size(r));
39 - if (info->mmio_base == NULL) {
40 - dev_err(&pdev->dev, "ioremap() failed\n");
41 - ret = -ENODEV;
42 - goto fail_free_res;
43 - }
44 info->mmio_phys = r->start;
45
46 ret = pxa3xx_nand_init_buff(info);
47 if (ret)
48 - goto fail_free_io;
49 + goto fail_put_clk;
50
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);
55 } else
56 kfree(info->data_buff);
57 -fail_free_io:
58 - iounmap(info->mmio_base);
59 -fail_free_res:
60 - release_mem_region(r->start, resource_size(r));
61 fail_put_clk:
62 clk_disable(info->clk);
63 clk_put(info->clk);
64 @@ -1169,7 +1151,6 @@ static int pxa3xx_nand_remove(struct pla
65 {
66 struct pxa3xx_nand_info *info = platform_get_drvdata(pdev);
67 struct pxa3xx_nand_platform_data *pdata;
68 - struct resource *r;
69 int irq, cs;
70
71 if (!info)
72 @@ -1188,10 +1169,6 @@ static int pxa3xx_nand_remove(struct pla
73 } else
74 kfree(info->data_buff);
75
76 - iounmap(info->mmio_base);
77 - r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
78 - release_mem_region(r->start, resource_size(r));
79 -
80 clk_disable(info->clk);
81 clk_put(info->clk);
82