[-next,15/30] pinctrl: oxnas: use devm_platform_ioremap_resource() to simplify code
diff mbox series

Message ID 20191017122640.22976-16-yuehaibing@huawei.com
State Awaiting Upstream
Delegated to: Geert Uytterhoeven
Headers show
Series
  • pinctrl: use devm_platform_ioremap_resource() to simplify code
Related show

Commit Message

Yuehaibing Oct. 17, 2019, 12:26 p.m. UTC
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/pinctrl/pinctrl-oxnas.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Neil Armstrong Oct. 17, 2019, 12:50 p.m. UTC | #1
On 17/10/2019 14:26, YueHaibing wrote:
> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/pinctrl/pinctrl-oxnas.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-oxnas.c b/drivers/pinctrl/pinctrl-oxnas.c
> index 40dc125..674b7b5 100644
> --- a/drivers/pinctrl/pinctrl-oxnas.c
> +++ b/drivers/pinctrl/pinctrl-oxnas.c
> @@ -1196,7 +1196,6 @@ static int oxnas_gpio_probe(struct platform_device *pdev)
>  	struct oxnas_gpio_bank *bank;
>  	unsigned int id, ngpios;
>  	int irq, ret;
> -	struct resource *res;
>  	struct gpio_irq_chip *girq;
>  
>  	if (of_parse_phandle_with_fixed_args(np, "gpio-ranges",
> @@ -1220,8 +1219,7 @@ static int oxnas_gpio_probe(struct platform_device *pdev)
>  
>  	bank = &oxnas_gpio_banks[id];
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	bank->reg_base = devm_ioremap_resource(&pdev->dev, res);
> +	bank->reg_base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(bank->reg_base))
>  		return PTR_ERR(bank->reg_base);
>  
> 

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

Patch
diff mbox series

diff --git a/drivers/pinctrl/pinctrl-oxnas.c b/drivers/pinctrl/pinctrl-oxnas.c
index 40dc125..674b7b5 100644
--- a/drivers/pinctrl/pinctrl-oxnas.c
+++ b/drivers/pinctrl/pinctrl-oxnas.c
@@ -1196,7 +1196,6 @@  static int oxnas_gpio_probe(struct platform_device *pdev)
 	struct oxnas_gpio_bank *bank;
 	unsigned int id, ngpios;
 	int irq, ret;
-	struct resource *res;
 	struct gpio_irq_chip *girq;
 
 	if (of_parse_phandle_with_fixed_args(np, "gpio-ranges",
@@ -1220,8 +1219,7 @@  static int oxnas_gpio_probe(struct platform_device *pdev)
 
 	bank = &oxnas_gpio_banks[id];
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	bank->reg_base = devm_ioremap_resource(&pdev->dev, res);
+	bank->reg_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(bank->reg_base))
 		return PTR_ERR(bank->reg_base);