public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/11] i2c: at91: Use devm_platform_get_and_ioremap_resource()
@ 2023-07-05 13:51 Yangtao Li
  2023-07-05 13:51 ` [PATCH 02/11] i2c: iproc: Convert to devm_platform_ioremap_resource() Yangtao Li
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Yangtao Li @ 2023-07-05 13:51 UTC (permalink / raw)
  To: Codrin Ciubotariu, Andi Shyti, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea
  Cc: Yangtao Li, linux-i2c, linux-arm-kernel, linux-kernel

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>
---
 drivers/i2c/busses/i2c-at91-core.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/busses/i2c-at91-core.c b/drivers/i2c/busses/i2c-at91-core.c
index 05ad3bc3578a..de3b8f1053e7 100644
--- a/drivers/i2c/busses/i2c-at91-core.c
+++ b/drivers/i2c/busses/i2c-at91-core.c
@@ -207,19 +207,15 @@ static int at91_twi_probe(struct platform_device *pdev)
 
 	dev->dev = &pdev->dev;
 
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!mem)
-		return -ENODEV;
+	dev->base = devm_platform_get_and_ioremap_resource(pdev, 0, &mem);
+	if (IS_ERR(dev->base))
+		return PTR_ERR(dev->base);
 	phy_addr = mem->start;
 
 	dev->pdata = at91_twi_get_driver_data(pdev);
 	if (!dev->pdata)
 		return -ENODEV;
 
-	dev->base = devm_ioremap_resource(&pdev->dev, mem);
-	if (IS_ERR(dev->base))
-		return PTR_ERR(dev->base);
-
 	dev->irq = platform_get_irq(pdev, 0);
 	if (dev->irq < 0)
 		return dev->irq;
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 02/11] i2c: iproc: Convert to devm_platform_ioremap_resource()
  2023-07-05 13:51 [PATCH 01/11] i2c: at91: Use devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-05 13:51 ` Yangtao Li
  2023-07-05 15:54   ` Ray Jui
  2023-07-05 13:51 ` [PATCH 03/11] i2c: brcmstb: " Yangtao Li
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Yangtao Li @ 2023-07-05 13:51 UTC (permalink / raw)
  To: Andi Shyti, Ray Jui, Scott Branden,
	Broadcom internal kernel review list
  Cc: Yangtao Li, linux-i2c, linux-arm-kernel, linux-kernel

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);
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 03/11] i2c: brcmstb: Convert to devm_platform_ioremap_resource()
  2023-07-05 13:51 [PATCH 01/11] i2c: at91: Use devm_platform_get_and_ioremap_resource() Yangtao Li
  2023-07-05 13:51 ` [PATCH 02/11] i2c: iproc: Convert to devm_platform_ioremap_resource() Yangtao Li
@ 2023-07-05 13:51 ` Yangtao Li
  2023-07-05 13:51 ` [PATCH 04/11] i2c: mlxbf: Use devm_platform_get_and_ioremap_resource() Yangtao Li
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Yangtao Li @ 2023-07-05 13:51 UTC (permalink / raw)
  To: Kamal Dasu, Broadcom internal kernel review list, Andi Shyti,
	Florian Fainelli
  Cc: Yangtao Li, linux-i2c, linux-arm-kernel, linux-kernel

Use devm_platform_ioremap_resource() to simplify code.

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

diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
index cf92cbcb8c86..0d422487161a 100644
--- a/drivers/i2c/busses/i2c-brcmstb.c
+++ b/drivers/i2c/busses/i2c-brcmstb.c
@@ -594,11 +594,10 @@ static int bcm2711_release_bsc(struct brcmstb_i2c_dev *dev)
 
 static int brcmstb_i2c_probe(struct platform_device *pdev)
 {
-	int rc = 0;
 	struct brcmstb_i2c_dev *dev;
 	struct i2c_adapter *adap;
-	struct resource *iomem;
 	const char *int_name;
+	int rc;
 
 	/* Allocate memory for private data structure */
 	dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
@@ -614,18 +613,15 @@ static int brcmstb_i2c_probe(struct platform_device *pdev)
 	init_completion(&dev->done);
 
 	/* Map hardware registers */
-	iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	dev->base = devm_ioremap_resource(dev->device, iomem);
-	if (IS_ERR(dev->base)) {
-		rc = -ENOMEM;
-		goto probe_errorout;
-	}
+	dev->base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(dev->base))
+		return PTR_ERR(dev->base);
 
 	if (of_device_is_compatible(dev->device->of_node,
 				    "brcm,bcm2711-hdmi-i2c")) {
 		rc = bcm2711_release_bsc(dev);
 		if (rc)
-			goto probe_errorout;
+			return rc;
 	}
 
 	rc = of_property_read_string(dev->device->of_node, "interrupt-names",
@@ -678,16 +674,13 @@ static int brcmstb_i2c_probe(struct platform_device *pdev)
 	adap->dev.of_node = pdev->dev.of_node;
 	rc = i2c_add_adapter(adap);
 	if (rc)
-		goto probe_errorout;
+		return rc;
 
 	dev_info(dev->device, "%s@%dhz registered in %s mode\n",
 		 int_name ? int_name : " ", dev->clk_freq_hz,
 		 (dev->irq >= 0) ? "interrupt" : "polling");
 
 	return 0;
-
-probe_errorout:
-	return rc;
 }
 
 static void brcmstb_i2c_remove(struct platform_device *pdev)
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 04/11] i2c: mlxbf: Use devm_platform_get_and_ioremap_resource()
  2023-07-05 13:51 [PATCH 01/11] i2c: at91: Use devm_platform_get_and_ioremap_resource() Yangtao Li
  2023-07-05 13:51 ` [PATCH 02/11] i2c: iproc: Convert to devm_platform_ioremap_resource() Yangtao Li
  2023-07-05 13:51 ` [PATCH 03/11] i2c: brcmstb: " Yangtao Li
@ 2023-07-05 13:51 ` Yangtao Li
  2023-07-05 13:51 ` [PATCH 05/11] i2c: stm32f4: " Yangtao Li
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Yangtao Li @ 2023-07-05 13:51 UTC (permalink / raw)
  To: Khalil Blaiech, Asmaa Mnebhi, Andi Shyti
  Cc: Yangtao Li, linux-i2c, linux-kernel

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>
---
 drivers/i2c/busses/i2c-mlxbf.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c
index ae66bdd1b737..2f60e5532b54 100644
--- a/drivers/i2c/busses/i2c-mlxbf.c
+++ b/drivers/i2c/busses/i2c-mlxbf.c
@@ -1080,13 +1080,7 @@ static int mlxbf_i2c_init_resource(struct platform_device *pdev,
 	if (!tmp_res)
 		return -ENOMEM;
 
-	tmp_res->params = platform_get_resource(pdev, IORESOURCE_MEM, type);
-	if (!tmp_res->params) {
-		devm_kfree(dev, tmp_res);
-		return -EIO;
-	}
-
-	tmp_res->io = devm_ioremap_resource(dev, tmp_res->params);
+	tmp_res->io = devm_platform_get_and_ioremap_resource(pdev, type, &tmp_res->params);
 	if (IS_ERR(tmp_res->io)) {
 		devm_kfree(dev, tmp_res);
 		return PTR_ERR(tmp_res->io);
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 05/11] i2c: stm32f4: Use devm_platform_get_and_ioremap_resource()
  2023-07-05 13:51 [PATCH 01/11] i2c: at91: Use devm_platform_get_and_ioremap_resource() Yangtao Li
                   ` (2 preceding siblings ...)
  2023-07-05 13:51 ` [PATCH 04/11] i2c: mlxbf: Use devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-05 13:51 ` Yangtao Li
  2023-07-05 13:51 ` [PATCH 06/11] i2c: qcom-geni: Convert to devm_platform_ioremap_resource() Yangtao Li
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Yangtao Li @ 2023-07-05 13:51 UTC (permalink / raw)
  To: Pierre-Yves MORDRET, Alain Volmat, Andi Shyti, Maxime Coquelin,
	Alexandre Torgue
  Cc: Yangtao Li, linux-i2c, linux-stm32, linux-arm-kernel,
	linux-kernel

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>
---
 drivers/i2c/busses/i2c-stm32f4.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-stm32f4.c b/drivers/i2c/busses/i2c-stm32f4.c
index 6ad06a5a22b4..ecc54792a66f 100644
--- a/drivers/i2c/busses/i2c-stm32f4.c
+++ b/drivers/i2c/busses/i2c-stm32f4.c
@@ -767,8 +767,7 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
 	if (!i2c_dev)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	i2c_dev->base = devm_ioremap_resource(&pdev->dev, res);
+	i2c_dev->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(i2c_dev->base))
 		return PTR_ERR(i2c_dev->base);
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 06/11] i2c: qcom-geni: Convert to devm_platform_ioremap_resource()
  2023-07-05 13:51 [PATCH 01/11] i2c: at91: Use devm_platform_get_and_ioremap_resource() Yangtao Li
                   ` (3 preceding siblings ...)
  2023-07-05 13:51 ` [PATCH 05/11] i2c: stm32f4: " Yangtao Li
@ 2023-07-05 13:51 ` Yangtao Li
  2023-07-05 13:51 ` [PATCH 07/11] i2c: st: Use devm_platform_get_and_ioremap_resource() Yangtao Li
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Yangtao Li @ 2023-07-05 13:51 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Andi Shyti
  Cc: Yangtao Li, linux-arm-msm, linux-i2c, linux-kernel

Use devm_platform_ioremap_resource() to simplify code.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/i2c/busses/i2c-qcom-geni.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
index b670a67c4fdd..229353e96e09 100644
--- a/drivers/i2c/busses/i2c-qcom-geni.c
+++ b/drivers/i2c/busses/i2c-qcom-geni.c
@@ -767,7 +767,6 @@ static int setup_gpi_dma(struct geni_i2c_dev *gi2c)
 static int geni_i2c_probe(struct platform_device *pdev)
 {
 	struct geni_i2c_dev *gi2c;
-	struct resource *res;
 	u32 proto, tx_depth, fifo_disable;
 	int ret;
 	struct device *dev = &pdev->dev;
@@ -779,8 +778,7 @@ static int geni_i2c_probe(struct platform_device *pdev)
 
 	gi2c->se.dev = dev;
 	gi2c->se.wrapper = dev_get_drvdata(dev->parent);
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	gi2c->se.base = devm_ioremap_resource(dev, res);
+	gi2c->se.base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(gi2c->se.base))
 		return PTR_ERR(gi2c->se.base);
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 07/11] i2c: st: Use devm_platform_get_and_ioremap_resource()
  2023-07-05 13:51 [PATCH 01/11] i2c: at91: Use devm_platform_get_and_ioremap_resource() Yangtao Li
                   ` (4 preceding siblings ...)
  2023-07-05 13:51 ` [PATCH 06/11] i2c: qcom-geni: Convert to devm_platform_ioremap_resource() Yangtao Li
@ 2023-07-05 13:51 ` Yangtao Li
  2023-07-05 13:51 ` [PATCH 08/11] i2c: sh_mobile: " Yangtao Li
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Yangtao Li @ 2023-07-05 13:51 UTC (permalink / raw)
  To: Patrice Chotard, Andi Shyti
  Cc: Yangtao Li, linux-arm-kernel, linux-i2c, linux-kernel

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>
---
 drivers/i2c/busses/i2c-st.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c
index 25c3521cae0e..ce2333408904 100644
--- a/drivers/i2c/busses/i2c-st.c
+++ b/drivers/i2c/busses/i2c-st.c
@@ -812,8 +812,7 @@ static int st_i2c_probe(struct platform_device *pdev)
 	if (!i2c_dev)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	i2c_dev->base = devm_ioremap_resource(&pdev->dev, res);
+	i2c_dev->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(i2c_dev->base))
 		return PTR_ERR(i2c_dev->base);
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 08/11] i2c: sh_mobile: Use devm_platform_get_and_ioremap_resource()
  2023-07-05 13:51 [PATCH 01/11] i2c: at91: Use devm_platform_get_and_ioremap_resource() Yangtao Li
                   ` (5 preceding siblings ...)
  2023-07-05 13:51 ` [PATCH 07/11] i2c: st: Use devm_platform_get_and_ioremap_resource() Yangtao Li
@ 2023-07-05 13:51 ` Yangtao Li
  2023-07-05 14:44   ` Geert Uytterhoeven
  2023-07-05 13:51 ` [PATCH 09/11] i2c: s3c2410: " Yangtao Li
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Yangtao Li @ 2023-07-05 13:51 UTC (permalink / raw)
  To: Wolfram Sang, Andi Shyti
  Cc: Yangtao Li, linux-renesas-soc, linux-i2c, linux-kernel

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>
---
 drivers/i2c/busses/i2c-sh_mobile.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 21717b943a9e..e2da633b5e9d 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -893,12 +893,10 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 	pd->dev = &dev->dev;
 	platform_set_drvdata(dev, pd);
 
-	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
-
-	pd->res = res;
-	pd->reg = devm_ioremap_resource(&dev->dev, res);
+	pd->reg = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(pd->reg))
 		return PTR_ERR(pd->reg);
+	pd->res = res;
 
 	ret = of_property_read_u32(dev->dev.of_node, "clock-frequency", &bus_speed);
 	pd->bus_speed = (ret || !bus_speed) ? I2C_MAX_STANDARD_MODE_FREQ : bus_speed;
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 09/11] i2c: s3c2410: Use devm_platform_get_and_ioremap_resource()
  2023-07-05 13:51 [PATCH 01/11] i2c: at91: Use devm_platform_get_and_ioremap_resource() Yangtao Li
                   ` (6 preceding siblings ...)
  2023-07-05 13:51 ` [PATCH 08/11] i2c: sh_mobile: " Yangtao Li
@ 2023-07-05 13:51 ` Yangtao Li
  2023-07-05 13:51 ` [PATCH 10/11] i2c: pxa: " Yangtao Li
  2023-07-05 13:51 ` [PATCH 11/11] i2c: pnx: " Yangtao Li
  9 siblings, 0 replies; 14+ messages in thread
From: Yangtao Li @ 2023-07-05 13:51 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Alim Akhtar, Andi Shyti
  Cc: Yangtao Li, linux-arm-kernel, linux-samsung-soc, linux-i2c,
	linux-kernel

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>
---
 drivers/i2c/busses/i2c-s3c2410.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 28f0e5c64f32..c14c3807e135 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -1034,9 +1034,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
 	dev_dbg(&pdev->dev, "clock source %p\n", i2c->clk);
 
 	/* map the registers */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	i2c->regs = devm_ioremap_resource(&pdev->dev, res);
-
+	i2c->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(i2c->regs))
 		return PTR_ERR(i2c->regs);
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 10/11] i2c: pxa: Use devm_platform_get_and_ioremap_resource()
  2023-07-05 13:51 [PATCH 01/11] i2c: at91: Use devm_platform_get_and_ioremap_resource() Yangtao Li
                   ` (7 preceding siblings ...)
  2023-07-05 13:51 ` [PATCH 09/11] i2c: s3c2410: " Yangtao Li
@ 2023-07-05 13:51 ` Yangtao Li
  2023-07-05 13:51 ` [PATCH 11/11] i2c: pnx: " Yangtao Li
  9 siblings, 0 replies; 14+ messages in thread
From: Yangtao Li @ 2023-07-05 13:51 UTC (permalink / raw)
  To: Andi Shyti; +Cc: Yangtao Li, linux-i2c, linux-kernel

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>
---
 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..73adcff3a54d 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(pdev, 0, &res);
 	if (IS_ERR(i2c->reg_base))
 		return PTR_ERR(i2c->reg_base);
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 11/11]  i2c: pnx: Use devm_platform_get_and_ioremap_resource()
  2023-07-05 13:51 [PATCH 01/11] i2c: at91: Use devm_platform_get_and_ioremap_resource() Yangtao Li
                   ` (8 preceding siblings ...)
  2023-07-05 13:51 ` [PATCH 10/11] i2c: pxa: " Yangtao Li
@ 2023-07-05 13:51 ` Yangtao Li
  9 siblings, 0 replies; 14+ messages in thread
From: Yangtao Li @ 2023-07-05 13:51 UTC (permalink / raw)
  To: Vladimir Zapolskiy, Andi Shyti
  Cc: Yangtao Li, linux-arm-kernel, linux-i2c, linux-kernel

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>
---
 drivers/i2c/busses/i2c-pnx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 82400057f810..ecbbb60407c3 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -683,8 +683,7 @@ static int i2c_pnx_probe(struct platform_device *pdev)
 		 "%s", pdev->name);
 
 	/* Register I/O resource */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	alg_data->ioaddr = devm_ioremap_resource(&pdev->dev, res);
+	alg_data->ioaddr = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(alg_data->ioaddr))
 		return PTR_ERR(alg_data->ioaddr);
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 08/11] i2c: sh_mobile: Use devm_platform_get_and_ioremap_resource()
  2023-07-05 13:51 ` [PATCH 08/11] i2c: sh_mobile: " Yangtao Li
@ 2023-07-05 14:44   ` Geert Uytterhoeven
  2023-07-06 19:21     ` Wolfram Sang
  0 siblings, 1 reply; 14+ messages in thread
From: Geert Uytterhoeven @ 2023-07-05 14:44 UTC (permalink / raw)
  To: Yangtao Li
  Cc: Wolfram Sang, Andi Shyti, linux-renesas-soc, linux-i2c,
	linux-kernel

Hi Yangtao,

On Wed, Jul 5, 2023 at 3:56 PM Yangtao Li <frank.li@vivo.com> 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>

Thanks for your patch!

> --- a/drivers/i2c/busses/i2c-sh_mobile.c
> +++ b/drivers/i2c/busses/i2c-sh_mobile.c
> @@ -893,12 +893,10 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
>         pd->dev = &dev->dev;
>         platform_set_drvdata(dev, pd);
>
> -       res = platform_get_resource(dev, IORESOURCE_MEM, 0);
> -
> -       pd->res = res;
> -       pd->reg = devm_ioremap_resource(&dev->dev, res);
> +       pd->reg = devm_platform_get_and_ioremap_resource(pdev, 0, &res);

"pdev" does not exist in this context.
Please try to at least compile-test your patches before submitting them.

>         if (IS_ERR(pd->reg))
>                 return PTR_ERR(pd->reg);
> +       pd->res = res;

While at it, you could get rid of "res", and replace it by "pd->res" in the
above call to devm_platform_get_and_ioremap_resource().

>
>         ret = of_property_read_u32(dev->dev.of_node, "clock-frequency", &bus_speed);
>         pd->bus_speed = (ret || !bus_speed) ? I2C_MAX_STANDARD_MODE_FREQ : bus_speed;

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 02/11] i2c: iproc: Convert to devm_platform_ioremap_resource()
  2023-07-05 13:51 ` [PATCH 02/11] i2c: iproc: Convert to devm_platform_ioremap_resource() Yangtao Li
@ 2023-07-05 15:54   ` Ray Jui
  0 siblings, 0 replies; 14+ messages in thread
From: Ray Jui @ 2023-07-05 15:54 UTC (permalink / raw)
  To: Yangtao Li, Andi Shyti, Ray Jui, Scott Branden,
	Broadcom internal kernel review list
  Cc: linux-i2c, linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1623 bytes --]



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.

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4194 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 08/11] i2c: sh_mobile: Use devm_platform_get_and_ioremap_resource()
  2023-07-05 14:44   ` Geert Uytterhoeven
@ 2023-07-06 19:21     ` Wolfram Sang
  0 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2023-07-06 19:21 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Yangtao Li, Andi Shyti, linux-renesas-soc, linux-i2c,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 178 bytes --]


> Please try to at least compile-test your patches before submitting them.

Yes and no. Not "please try" but "please do". Rejecting this series
until it has been build tested.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-07-06 19:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-05 13:51 [PATCH 01/11] i2c: at91: Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-05 13:51 ` [PATCH 02/11] i2c: iproc: Convert to devm_platform_ioremap_resource() Yangtao Li
2023-07-05 15:54   ` Ray Jui
2023-07-05 13:51 ` [PATCH 03/11] i2c: brcmstb: " Yangtao Li
2023-07-05 13:51 ` [PATCH 04/11] i2c: mlxbf: Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-05 13:51 ` [PATCH 05/11] i2c: stm32f4: " Yangtao Li
2023-07-05 13:51 ` [PATCH 06/11] i2c: qcom-geni: Convert to devm_platform_ioremap_resource() Yangtao Li
2023-07-05 13:51 ` [PATCH 07/11] i2c: st: Use devm_platform_get_and_ioremap_resource() Yangtao Li
2023-07-05 13:51 ` [PATCH 08/11] i2c: sh_mobile: " Yangtao Li
2023-07-05 14:44   ` Geert Uytterhoeven
2023-07-06 19:21     ` Wolfram Sang
2023-07-05 13:51 ` [PATCH 09/11] i2c: s3c2410: " Yangtao Li
2023-07-05 13:51 ` [PATCH 10/11] i2c: pxa: " Yangtao Li
2023-07-05 13:51 ` [PATCH 11/11] i2c: pnx: " Yangtao Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox