Skip to contentSkip to conversation

video: pxafb: Use devm_platform_ioremap_resource() in pxafb_probe()

PATCH In review Markus Elfring 2 participants 2 messages Sep 19, 2019 – Jan 3, 2020

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

PATCH 1/1 video: pxafb: Use devm_platform_ioremap_resource() in pxafb_probe()

From: Markus Elfring <[email protected]>
Date: Thu, 19 Sep 2019 16:51:38 +0200

Simplify this function implementation by using a known wrapper function.

This issue was detected by using the Coccinelle software.

---
 drivers/video/fbdev/pxafb.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/video/fbdev/pxafb.c +1 -9
index f70c9f79622e..237f8f436fdb 100644
@@ -2237,7 +2237,6 @@ static int pxafb_probe(struct platform_device *dev)
 {
 	struct pxafb_info *fbi;
 	struct pxafb_mach_info *inf, *pdata;
-	struct resource *r;
 	int i, irq, ret;
 
 	dev_dbg(&dev->dev, "pxafb_probe\n");
@@ -2303,14 +2302,7 @@ static int pxafb_probe(struct platform_device *dev)
 		fbi->lcd_supply = NULL;
 	}
 
-	r = platform_get_resource(dev, IORESOURCE_MEM, 0);
-	if (r == NULL) {
-		dev_err(&dev->dev, "no I/O memory resource defined\n");
-		ret = -ENODEV;
-		goto failed;
-	}
-
-	fbi->mmio_base = devm_ioremap_resource(&dev->dev, r);
+	fbi->mmio_base = devm_platform_ioremap_resource(dev, 0);
 	if (IS_ERR(fbi->mmio_base)) {
 		dev_err(&dev->dev, "failed to get I/O memory\n");
 		ret = -EBUSY;

--
2.23.0

#1 lore raw
Quoted 8 lines · Markus Elfring

From: Markus Elfring <[email protected]>
Date: Thu, 19 Sep 2019 16:51:38 +0200

Simplify this function implementation by using a known wrapper function.

This issue was detected by using the Coccinelle software.

Thanks, patch queued for v5.6 (also sorry for the delay).

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Quoted 34 lines
---
 drivers/video/fbdev/pxafb.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/video/fbdev/pxafb.c +1 -10
index f70c9f79622e..237f8f436fdb 100644
@@ -2237,7 +2237,6 @@ static int pxafb_probe(struct platform_device *dev)
 {
 	struct pxafb_info *fbi;
 	struct pxafb_mach_info *inf, *pdata;
-	struct resource *r;
 	int i, irq, ret;
 
 	dev_dbg(&dev->dev, "pxafb_probe\n");
@@ -2303,14 +2302,7 @@ static int pxafb_probe(struct platform_device *dev)
 		fbi->lcd_supply = NULL;
 	}
 
-	r = platform_get_resource(dev, IORESOURCE_MEM, 0);
-	if (r = NULL) {
-		dev_err(&dev->dev, "no I/O memory resource defined\n");
-		ret = -ENODEV;
-		goto failed;
-	}
-
-	fbi->mmio_base = devm_ioremap_resource(&dev->dev, r);
+	fbi->mmio_base = devm_platform_ioremap_resource(dev, 0);
 	if (IS_ERR(fbi->mmio_base)) {
 		dev_err(&dev->dev, "failed to get I/O memory\n");
 		ret = -EBUSY;
--

2.23.0