Skip to contentSkip to conversation

media: staging: tegra-vde: Use devm_platform_ioremap_resource_byname()

PATCH Superseded Dmitry Osipenko 2 participants 4 messages Feb 27, 2020 – Mar 2, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: staging: tegra-vde: Use devm_platform_ioremap_resource_byname()

This helps to make code cleaner a tad.

---
 drivers/staging/media/tegra-vde/vde.c | 55 +++++----------------------
 1 file changed, 9 insertions(+), 46 deletions(-)
drivers/staging/media/tegra-vde/vde.c +9 -46
index e18fd48981da..d3e63512a765 100644
@@ -949,7 +949,6 @@ static int tegra_vde_runtime_resume(struct device *dev)
 static int tegra_vde_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct resource *regs;
 	struct tegra_vde *vde;
 	int irq, err;
 
@@ -959,75 +958,39 @@ static int tegra_vde_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, vde);
 
-	regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sxe");
-	if (!regs)
-		return -ENODEV;
-
-	vde->sxe = devm_ioremap_resource(dev, regs);
+	vde->sxe = devm_platform_ioremap_resource_byname(pdev, "sxe");
 	if (IS_ERR(vde->sxe))
 		return PTR_ERR(vde->sxe);
 
-	regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "bsev");
-	if (!regs)
-		return -ENODEV;
-
-	vde->bsev = devm_ioremap_resource(dev, regs);
+	vde->bsev = devm_platform_ioremap_resource_byname(pdev, "bsev");
 	if (IS_ERR(vde->bsev))
 		return PTR_ERR(vde->bsev);
 
-	regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mbe");
-	if (!regs)
-		return -ENODEV;
-
-	vde->mbe = devm_ioremap_resource(dev, regs);
+	vde->mbe = devm_platform_ioremap_resource_byname(pdev, "mbe");
 	if (IS_ERR(vde->mbe))
 		return PTR_ERR(vde->mbe);
 
-	regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ppe");
-	if (!regs)
-		return -ENODEV;
-
-	vde->ppe = devm_ioremap_resource(dev, regs);
+	vde->ppe = devm_platform_ioremap_resource_byname(pdev, "ppe");
 	if (IS_ERR(vde->ppe))
 		return PTR_ERR(vde->ppe);
 
-	regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mce");
-	if (!regs)
-		return -ENODEV;
-
-	vde->mce = devm_ioremap_resource(dev, regs);
+	vde->mce = devm_platform_ioremap_resource_byname(pdev, "mce");
 	if (IS_ERR(vde->mce))
 		return PTR_ERR(vde->mce);
 
-	regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tfe");
-	if (!regs)
-		return -ENODEV;
-
-	vde->tfe = devm_ioremap_resource(dev, regs);
+	vde->tfe = devm_platform_ioremap_resource_byname(pdev, "tfe");
 	if (IS_ERR(vde->tfe))
 		return PTR_ERR(vde->tfe);
 
-	regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ppb");
-	if (!regs)
-		return -ENODEV;
-
-	vde->ppb = devm_ioremap_resource(dev, regs);
+	vde->ppb = devm_platform_ioremap_resource_byname(pdev, "ppb");
 	if (IS_ERR(vde->ppb))
 		return PTR_ERR(vde->ppb);
 
-	regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vdma");
-	if (!regs)
-		return -ENODEV;
-
-	vde->vdma = devm_ioremap_resource(dev, regs);
+	vde->vdma = devm_platform_ioremap_resource_byname(pdev, "vdma");
 	if (IS_ERR(vde->vdma))
 		return PTR_ERR(vde->vdma);
 
-	regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "frameid");
-	if (!regs)
-		return -ENODEV;
-
-	vde->frameid = devm_ioremap_resource(dev, regs);
+	vde->frameid = devm_platform_ioremap_resource_byname(pdev, "frameid");
 	if (IS_ERR(vde->frameid))
 		return PTR_ERR(vde->frameid);
 
Signature · 1 line
2.24.0
#2 lore raw

02.03.2020 11:04, Dan Carpenter пишет:

Quoted 4 lines · Dmitry Osipenko
Quoted 1 line

This helps to make code cleaner a tad.

Please don't start the commit message in the middle of a sentence.

Could you please clarify what do you mean by the "middle of a sentence"? The commit's message doesn't sound "middle" to me at all.

Quoted 3 lines

It looks like this for some of us:

https://marc.info/?l=linux-driver-devel&m=158282701430176&w=2

This link points to this patch, I don't quite understand what you're trying to convey here.

Quoted 2 lines

I generally read the subject or the full commit message but seldom both.

The commit's title describes the change briefly, while the message gives a rational for the change. Usually reviewer should consult the code changes themselves for more details.

Do you have some kind of a email filter that shows only the commit's message? Otherwise I'm not sure what's the problem.

Quoted 1 line

Otherwise the patch looks very good.

Thanks

#3 lore raw
Quoted 19 lines · Dmitry Osipenko

02.03.2020 11:04, Dan Carpenter пишет:

Quoted 4 lines · Dmitry Osipenko
Quoted 1 line

This helps to make code cleaner a tad.

Please don't start the commit message in the middle of a sentence.

Could you please clarify what do you mean by the "middle of a sentence"? The commit's message doesn't sound "middle" to me at all.

Quoted 3 lines

It looks like this for some of us:

https://marc.info/?l=linux-driver-devel&m=158282701430176&w=2

This link points to this patch, I don't quite understand what you're trying to convey here.

Quoted 2 lines

I generally read the subject or the full commit message but seldom both.

Quoted 6 lines

The commit's title describes the change briefly, while the message gives a rational for the change. Usually reviewer should consult the code changes themselves for more details.

Do you have some kind of a email filter that shows only the commit's message? Otherwise I'm not sure what's the problem.

The commit message just says "This helps to make code cleaner a tad." but it doesn't mention devm_platform_ioremap_resource_byname(). That information is there in the subject but not in the commit message itself. Take a look at the link I sent you and try to find the subject. It's far away from the commit message.

regards,
dan carpenter