pinctrl: sunxi: Switch to devm_ioremap_resource
authorMaxime Ripard <maxime.ripard@free-electrons.com>
Sat, 26 Apr 2014 19:59:50 +0000 (21:59 +0200)
committerMaxime Ripard <maxime.ripard@free-electrons.com>
Sun, 4 May 2014 06:59:44 +0000 (23:59 -0700)
The previous code was calling of_iomap, which doesn't do any resource
management, and doesn't call request_mem_region either. Use
devm_ioremap_resource that do both.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
drivers/pinctrl/sunxi/pinctrl-sunxi.c

index c8b321ae6b172e99169617cf4df9de357a77d84f..f0e908702ebe1b4de14ed35e3752635861c102fd 100644 (file)
@@ -794,6 +794,7 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)
        struct pinctrl_pin_desc *pins;
        struct sunxi_pinctrl *pctl;
        struct reset_control *rstc;
+       struct resource *res;
        int i, ret, last_pin;
        struct clk *clk;
 
@@ -804,9 +805,10 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)
 
        spin_lock_init(&pctl->lock);
 
-       pctl->membase = of_iomap(node, 0);
-       if (!pctl->membase)
-               return -ENOMEM;
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       pctl->membase = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(pctl->membase))
+               return PTR_ERR(pctl->membase);
 
        device = of_match_device(sunxi_pinctrl_match, &pdev->dev);
        if (!device)