diff mbox series

[v2,10/11] i2c: pxa: Use devm_platform_get_and_ioremap_resource()

Message ID 20230710063351.17490-10-frank.li@vivo.com
State New
Headers show
Series [v2,01/11] i2c: at91: Use devm_platform_get_and_ioremap_resource() | expand

Commit Message

Yangtao Li July 10, 2023, 6:33 a.m. UTC
Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
v2:
-s/devm_platform_get_and_ioremap_resource(pdev/devm_platform_get_and_ioremap_resource(dev
 drivers/i2c/busses/i2c-pxa.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Andi Shyti July 12, 2023, 3:59 p.m. UTC | #1
Hi Yangtao,

On Mon, Jul 10, 2023 at 02:33:49PM +0800, Yangtao Li wrote:
> Convert platform_get_resource(), devm_ioremap_resource() to a single
> call to devm_platform_get_and_ioremap_resource(), as this is exactly
> what this function does.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>

Reviewed-by: Andi Shyti <andi.shyti@kernel.org> 

Andi

> ---
> v2:
> -s/devm_platform_get_and_ioremap_resource(pdev/devm_platform_get_and_ioremap_resource(dev
>  drivers/i2c/busses/i2c-pxa.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index 937f7eebe906..b630bfeaeb85 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -1362,7 +1362,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
>  	struct i2c_pxa_platform_data *plat = dev_get_platdata(&dev->dev);
>  	enum pxa_i2c_types i2c_type;
>  	struct pxa_i2c *i2c;
> -	struct resource *res = NULL;
> +	struct resource *res;
>  	int ret, irq;
>  
>  	i2c = devm_kzalloc(&dev->dev, sizeof(struct pxa_i2c), GFP_KERNEL);
> @@ -1379,8 +1379,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
>  	i2c->adap.dev.of_node = dev->dev.of_node;
>  #endif
>  
> -	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
> -	i2c->reg_base = devm_ioremap_resource(&dev->dev, res);
> +	i2c->reg_base = devm_platform_get_and_ioremap_resource(dev, 0, &res);
>  	if (IS_ERR(i2c->reg_base))
>  		return PTR_ERR(i2c->reg_base);
>  
> -- 
> 2.39.0
>
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 937f7eebe906..b630bfeaeb85 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1362,7 +1362,7 @@  static int i2c_pxa_probe(struct platform_device *dev)
 	struct i2c_pxa_platform_data *plat = dev_get_platdata(&dev->dev);
 	enum pxa_i2c_types i2c_type;
 	struct pxa_i2c *i2c;
-	struct resource *res = NULL;
+	struct resource *res;
 	int ret, irq;
 
 	i2c = devm_kzalloc(&dev->dev, sizeof(struct pxa_i2c), GFP_KERNEL);
@@ -1379,8 +1379,7 @@  static int i2c_pxa_probe(struct platform_device *dev)
 	i2c->adap.dev.of_node = dev->dev.of_node;
 #endif
 
-	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
-	i2c->reg_base = devm_ioremap_resource(&dev->dev, res);
+	i2c->reg_base = devm_platform_get_and_ioremap_resource(dev, 0, &res);
 	if (IS_ERR(i2c->reg_base))
 		return PTR_ERR(i2c->reg_base);