Skip to contentSkip to conversation

can: ctucanfd: Use devm_platform_ioremap_resource()

PATCH In review Yang Li 4 participants 4 messages Feb 16, 2023

Subsystems (4)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 can: ctucanfd: Use devm_platform_ioremap_resource()

Convert platform_get_resource(), devm_ioremap_resource() to a single call to Use devm_platform_ioremap_resource(), as this is exactly what this function does.

---
 drivers/net/can/ctucanfd/ctucanfd_platform.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/can/ctucanfd/ctucanfd_platform.c +1 -3
index f83684f006ea..a17561d97192 100644
@@ -47,7 +47,6 @@ static void ctucan_platform_set_drvdata(struct device *dev,
  */
 static int ctucan_platform_probe(struct platform_device *pdev)
 {
-	struct resource *res; /* IO mem resources */
 	struct device	*dev = &pdev->dev;
 	void __iomem *addr;
 	int ret;
@@ -55,8 +54,7 @@ static int ctucan_platform_probe(struct platform_device *pdev)
 	int irq;
 
 	/* Get the virtual base address for the device */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	addr = devm_ioremap_resource(dev, res);
+	addr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(addr)) {
 		ret = PTR_ERR(addr);
 		goto err;
Signature · 1 line
2.20.1.7.g153144c
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · On Thursday 16 of February 2023 10:06:10 Yang Li wrote:

Convert platform_get_resource(), devm_ioremap_resource() to a single call to Use devm_platform_ioremap_resource(), as this is exactly what this function does.

Quoted 27 lines
---
 drivers/net/can/ctucanfd/ctucanfd_platform.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/net/can/ctucanfd/ctucanfd_platform.c index f83684f006ea..a17561d97192 100644

drivers/net/can/ctucanfd/ctucanfd_platform.c +1 -3
@@ -47,7 +47,6 @@ static void ctucan_platform_set_drvdata(struct device
 *dev, */
 static int ctucan_platform_probe(struct platform_device *pdev)
 {
-	struct resource *res; /* IO mem resources */
 	struct device	*dev = &pdev->dev;
 	void __iomem *addr;
 	int ret;
@@ -55,8 +54,7 @@ static int ctucan_platform_probe(struct platform_device
 *pdev) int irq;
 
 	/* Get the virtual base address for the device */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	addr = devm_ioremap_resource(dev, res);
+	addr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(addr)) {
 		ret = PTR_ERR(addr);
 		goto err;
Signature · 11 lines
                Pavel Pisa
    e-mail:     [email protected]
    Department of Control Engineering FEE CVUT
    Karlovo namesti 13, 121 35, Prague 2
    university: http://control.fel.cvut.cz/
    personal:   http://cmp.felk.cvut.cz/~pisa
    projects:   https://www.openhub.net/accounts/ppisa
    CAN related:http://canbus.pages.fel.cvut.cz/
    RISC-V education: https://comparch.edu.cvut.cz/
    Open Technologies Research Education and Exchange Services
    https://gitlab.fel.cvut.cz/otrees/org/-/wikis/home
Reviewed-by on v1 1/1
#2 lore raw
In reply to Yang Li

From: Yang Li <[email protected]>
Date: Thu, 16 Feb 2023 17:06:10 +0800

Quoted 5 lines

Convert platform_get_resource(), devm_ioremap_resource() to a single call to Use devm_platform_ioremap_resource(), as this is exactly what this function does.

Quoted 17 lines
---
 drivers/net/can/ctucanfd/ctucanfd_platform.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/can/ctucanfd/ctucanfd_platform.c +0 -1
index f83684f006ea..a17561d97192 100644
@@ -47,7 +47,6 @@ static void ctucan_platform_set_drvdata(struct device *dev,
  */
 static int ctucan_platform_probe(struct platform_device *pdev)
 {
-	struct resource *res; /* IO mem resources */
 	struct device	*dev = &pdev->dev;
 	void __iomem *addr;
 	int ret;

drivers/net/can/ctucanfd/ctucanfd_platform.c static int ctucan_platform_probe(struct platform_device *pdev) · line 60

Quoted 9 lines
drivers/net/can/ctucanfd/ctucanfd_platform.c +1 -2
@@ -55,8 +54,7 @@ static int ctucan_platform_probe(struct platform_device *pdev)
 	int irq;
 
 	/* Get the virtual base address for the device */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	addr = devm_ioremap_resource(dev, res);
+	addr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(addr)) {
 		ret = PTR_ERR(addr);
 		goto err;

Thanks,
Olek

#3 lore raw
In reply to Yang Li
Quoted 5 lines · Yang Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to Use devm_platform_ioremap_resource(), as this is exactly what this function does.

Applied to linux-can-next/testing.

Thanks,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |