[02/11] i2c: iproc: Convert to devm_platform_ioremap_resource()

Message ID 20230705135159.33327-2-frank.li@vivo.com
State New
Headers
Series [01/11] i2c: at91: Use devm_platform_get_and_ioremap_resource() |

Commit Message

李扬韬 July 5, 2023, 1:51 p.m. UTC
  Use devm_platform_ioremap_resource() to simplify code.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/i2c/busses/i2c-bcm-iproc.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
  

Comments

Ray Jui July 5, 2023, 3:54 p.m. UTC | #1
On 7/5/2023 6:51 AM, Yangtao Li wrote:
> Use devm_platform_ioremap_resource() to simplify code.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  drivers/i2c/busses/i2c-bcm-iproc.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c
> index 2d8342fdc25d..3fac85be543a 100644
> --- a/drivers/i2c/busses/i2c-bcm-iproc.c
> +++ b/drivers/i2c/busses/i2c-bcm-iproc.c
> @@ -1026,7 +1026,6 @@ static int bcm_iproc_i2c_probe(struct platform_device *pdev)
>  	int irq, ret = 0;
>  	struct bcm_iproc_i2c_dev *iproc_i2c;
>  	struct i2c_adapter *adap;
> -	struct resource *res;
>  
>  	iproc_i2c = devm_kzalloc(&pdev->dev, sizeof(*iproc_i2c),
>  				 GFP_KERNEL);
> @@ -1039,15 +1038,12 @@ static int bcm_iproc_i2c_probe(struct platform_device *pdev)
>  		(enum bcm_iproc_i2c_type)of_device_get_match_data(&pdev->dev);
>  	init_completion(&iproc_i2c->done);
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	iproc_i2c->base = devm_ioremap_resource(iproc_i2c->device, res);
> +	iproc_i2c->base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(iproc_i2c->base))
>  		return PTR_ERR(iproc_i2c->base);
>  
>  	if (iproc_i2c->type == IPROC_I2C_NIC) {
> -		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> -		iproc_i2c->idm_base = devm_ioremap_resource(iproc_i2c->device,
> -							    res);
> +		iproc_i2c->idm_base = devm_platform_ioremap_resource(pdev, 1);
>  		if (IS_ERR(iproc_i2c->idm_base))
>  			return PTR_ERR(iproc_i2c->idm_base);
>  

Acked-by: Ray Jui <ray.jui@broadcom.com>

Thanks.
  

Patch

diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c
index 2d8342fdc25d..3fac85be543a 100644
--- a/drivers/i2c/busses/i2c-bcm-iproc.c
+++ b/drivers/i2c/busses/i2c-bcm-iproc.c
@@ -1026,7 +1026,6 @@  static int bcm_iproc_i2c_probe(struct platform_device *pdev)
 	int irq, ret = 0;
 	struct bcm_iproc_i2c_dev *iproc_i2c;
 	struct i2c_adapter *adap;
-	struct resource *res;
 
 	iproc_i2c = devm_kzalloc(&pdev->dev, sizeof(*iproc_i2c),
 				 GFP_KERNEL);
@@ -1039,15 +1038,12 @@  static int bcm_iproc_i2c_probe(struct platform_device *pdev)
 		(enum bcm_iproc_i2c_type)of_device_get_match_data(&pdev->dev);
 	init_completion(&iproc_i2c->done);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	iproc_i2c->base = devm_ioremap_resource(iproc_i2c->device, res);
+	iproc_i2c->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(iproc_i2c->base))
 		return PTR_ERR(iproc_i2c->base);
 
 	if (iproc_i2c->type == IPROC_I2C_NIC) {
-		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-		iproc_i2c->idm_base = devm_ioremap_resource(iproc_i2c->device,
-							    res);
+		iproc_i2c->idm_base = devm_platform_ioremap_resource(pdev, 1);
 		if (IS_ERR(iproc_i2c->idm_base))
 			return PTR_ERR(iproc_i2c->idm_base);