Skip to contentSkip to conversation

i2c: mxs: use devm_platform_ioremap_resource() to simplify code

PATCH Applied [email protected] 3 participants 6 messages Jul 17, 2019 – Aug 1, 2019

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

PATCH 1/2 i2c: mxs: use devm_platform_ioremap_resource() to simplify code

From: Anson Huang <[email protected]>

Use the new helper devm_platform_ioremap_resource() which wraps the platform_get_resource() and devm_ioremap_resource() together, to simplify the code.

---
 drivers/i2c/busses/i2c-mxs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/i2c/busses/i2c-mxs.c +1 -3
index 7d79317..8922491 100644
@@ -802,7 +802,6 @@ static int mxs_i2c_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct mxs_i2c_dev *i2c;
 	struct i2c_adapter *adap;
-	struct resource *res;
 	int err, irq;
 
 	i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL);
@@ -814,8 +813,7 @@ static int mxs_i2c_probe(struct platform_device *pdev)
 		i2c->dev_type = device_id->driver_data;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	i2c->regs = devm_ioremap_resource(&pdev->dev, res);
+	i2c->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(i2c->regs))
 		return PTR_ERR(i2c->regs);
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 i2c: imx-lpi2c: use devm_platform_ioremap_resource() to simplify code

From: Anson Huang <[email protected]>

Use the new helper devm_platform_ioremap_resource() which wraps the platform_get_resource() and devm_ioremap_resource() together, to simplify the code.

---
 drivers/i2c/busses/i2c-imx-lpi2c.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/i2c/busses/i2c-imx-lpi2c.c +1 -3
index dc00fab..c92b564 100644
@@ -545,7 +545,6 @@ MODULE_DEVICE_TABLE(of, lpi2c_imx_of_match);
 static int lpi2c_imx_probe(struct platform_device *pdev)
 {
 	struct lpi2c_imx_struct *lpi2c_imx;
-	struct resource *res;
 	unsigned int temp;
 	int irq, ret;
 
@@ -553,8 +552,7 @@ static int lpi2c_imx_probe(struct platform_device *pdev)
 	if (!lpi2c_imx)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	lpi2c_imx->base = devm_ioremap_resource(&pdev->dev, res);
+	lpi2c_imx->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(lpi2c_imx->base))
 		return PTR_ERR(lpi2c_imx->base);
 
Signature · 1 line
2.7.4
maintainer Reviewed-by on v1 1/2
#4 lore raw
In reply to [email protected]
Quoted 8 lines

From: [email protected] <[email protected]>
Sent: Wednesday, July 17, 2019 4:40 PM

Use the new helper devm_platform_ioremap_resource() which wraps the platform_get_resource() and devm_ioremap_resource() together, to simplify the code.

Regards
Aisheng

Quoted 29 lines
---
 drivers/i2c/busses/i2c-mxs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/i2c/busses/i2c-mxs.c index renamed from drivers/i2c/busses/i2c-mxs.c +0 -0

7d79317..8922491 100644

drivers/i2c/busses/i2c-mxs.c +0 -1
@@ -802,7 +802,6 @@ static int mxs_i2c_probe(struct platform_device
 *pdev)
 	struct device *dev = &pdev->dev;
 	struct mxs_i2c_dev *i2c;
 	struct i2c_adapter *adap;
-	struct resource *res;
 	int err, irq;
 

i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); @@ -814,8 +813,7
@@ static int mxs_i2c_probe(struct platform_device *pdev)

drivers/i2c/busses/i2c-mxs.c +1 -3
 		i2c->dev_type = device_id->driver_data;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	i2c->regs = devm_ioremap_resource(&pdev->dev, res);
+	i2c->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(i2c->regs))
 		return PTR_ERR(i2c->regs);
 
--

2.7.4

maintainer Acked-by on v1 2/2
#2 lore raw

RE: [PATCH 2/2] i2c: imx-lpi2c: use devm_platform_ioremap_resource() to simplify code

In reply to [email protected]
Quoted 8 lines

From: [email protected] <[email protected]>
Sent: Wednesday, July 17, 2019 4:40 PM

Use the new helper devm_platform_ioremap_resource() which wraps the platform_get_resource() and devm_ioremap_resource() together, to simplify the code.

Regards
Aisheng

Applied
#3 lore raw

Re: [PATCH 2/2] i2c: imx-lpi2c: use devm_platform_ioremap_resource() to simplify code

In reply to [email protected]
Quoted 7 lines · On Wed, Jul 17, 2019 at 04:40:17PM +0800, [email protected] wrote:

From: Anson Huang <[email protected]>

Use the new helper devm_platform_ioremap_resource() which wraps the platform_get_resource() and devm_ioremap_resource() together, to simplify the code.

Applied to for-next, thanks!