2022-11-10 09:55:09

by ye.xingchen

[permalink] [raw]
Subject: [PATCH] i2c: imx: use devm_platform_get_and_ioremap_resource()

From: Minghao Chi <[email protected]>

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.

Reported-by: Zeal Robot <[email protected]>
Signed-off-by: Minghao Chi <[email protected]>
---
drivers/i2c/busses/i2c-imx.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 3082183bd66a..1ce0cf7a323f 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1449,8 +1449,7 @@ static int i2c_imx_probe(struct platform_device *pdev)
if (irq < 0)
return irq;

- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- base = devm_ioremap_resource(&pdev->dev, res);
+ base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
if (IS_ERR(base))
return PTR_ERR(base);

--
2.25.1


2022-11-10 12:11:12

by Mukesh Ojha

[permalink] [raw]
Subject: Re: [PATCH] i2c: imx: use devm_platform_get_and_ioremap_resource()

Hi,

On 11/10/2022 2:53 PM, [email protected] wrote:
> From: Minghao Chi <[email protected]>
>
> 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.
>
> Reported-by: Zeal Robot <[email protected]>
> Signed-off-by: Minghao Chi <[email protected]>
> ---
> drivers/i2c/busses/i2c-imx.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 3082183bd66a..1ce0cf7a323f 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -1449,8 +1449,7 @@ static int i2c_imx_probe(struct platform_device *pdev)
> if (irq < 0)
> return irq;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - base = devm_ioremap_resource(&pdev->dev, res);
> + base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> if (IS_ERR(base))
> return PTR_ERR(base);
>

LGTM.
Reviewed-by: Mukesh Ojha <[email protected]>

_Mukesh

2022-11-10 15:27:19

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH] i2c: imx: use devm_platform_get_and_ioremap_resource()

On Thu, Nov 10, 2022 at 05:23:42PM +0800, [email protected] wrote:
> From: Minghao Chi <[email protected]>
>
> 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.
>
> Reported-by: Zeal Robot <[email protected]>
> Signed-off-by: Minghao Chi <[email protected]>

As res is used later, we cannot switch to
devm_platform_ioremap_resource(), so the patch is fine.

Reviewed-by: Uwe Kleine-K?nig <[email protected]>

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | https://www.pengutronix.de/ |


Attachments:
(No filename) (749.00 B)
signature.asc (499.00 B)
Download all attachments

2022-11-12 20:51:45

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH] i2c: imx: use devm_platform_get_and_ioremap_resource()

On Thu, Nov 10, 2022 at 05:23:42PM +0800, [email protected] wrote:
> From: Minghao Chi <[email protected]>
>
> 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.
>
> Reported-by: Zeal Robot <[email protected]>
> Signed-off-by: Minghao Chi <[email protected]>

Applied to for-next, thanks!


Attachments:
(No filename) (435.00 B)
signature.asc (849.00 B)
Download all attachments