Skip to contentSkip to conversation

i2c: imx: use devm_platform_get_and_ioremap_resource()

PATCH Applied [email protected] 4 participants 4 messages Nov 10, 2022 – Nov 12, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/i2c/busses/i2c-imx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/i2c/busses/i2c-imx.c +1 -2
index 3082183bd66a..1ce0cf7a323f 100644
@@ -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);
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 17 lines · 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.

---
  drivers/i2c/busses/i2c-imx.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/i2c/busses/i2c-imx.c +0 -0
index 3082183bd66a..1ce0cf7a323f 100644

drivers/i2c/busses/i2c-imx.c static int i2c_imx_probe(struct platform_device *pdev) · line 1455

Quoted 9 lines
drivers/i2c/busses/i2c-imx.c +1 -2
@@ -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.

_Mukesh

Reviewed-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 8 lines · 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.

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

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |