Skip to contentSkip to conversation

net: dsa: vsc73xx: Adjustments for vsc73xx_platform_probe()

PATCH In review Markus Elfring 4 participants 10 messages Sep 20, 2019 – Sep 21, 2019

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

cover net: dsa: vsc73xx: Adjustments for vsc73xx_platform_probe()

From: Markus Elfring <[email protected]>
Date: Fri, 20 Sep 2019 16:17:18 +0200

Two update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
Use devm_platform_ioremap_resource()
Return an error code as a constant

 drivers/net/dsa/vitesse-vsc73xx-platform.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

--
2.23.0

#1 lore raw

PATCH 1/2 net: dsa: vsc73xx: Use devm_platform_ioremap_resource() in vsc73xx_platform_probe()

From: Markus Elfring <[email protected]>
Date: Fri, 20 Sep 2019 15:23:39 +0200

Simplify this function implementation by using a known wrapper function.

This issue was detected by using the Coccinelle software.

---
 drivers/net/dsa/vitesse-vsc73xx-platform.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/net/dsa/vitesse-vsc73xx-platform.c +1 -11
index 0541785f9fee..a3bbf9bd1bf1 100644
@@ -89,7 +89,6 @@ static int vsc73xx_platform_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct vsc73xx_platform *vsc_platform;
-	struct resource *res = NULL;
 	int ret;
 
 	vsc_platform = devm_kzalloc(dev, sizeof(*vsc_platform), GFP_KERNEL);
@@ -101,16 +100,7 @@ static int vsc73xx_platform_probe(struct platform_device *pdev)
 	vsc_platform->vsc.dev = dev;
 	vsc_platform->vsc.priv = vsc_platform;
 	vsc_platform->vsc.ops = &vsc73xx_platform_ops;
-
-	/* obtain I/O memory space */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "cannot obtain I/O memory space\n");
-		ret = -ENXIO;
-		return ret;
-	}
-
-	vsc_platform->base_addr = devm_ioremap_resource(&pdev->dev, res);
+	vsc_platform->base_addr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(vsc_platform->base_addr)) {
 		dev_err(&pdev->dev, "cannot request I/O memory space\n");
 		ret = -ENXIO;

--
2.23.0

maintainer Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] net: dsa: vsc73xx: Use devm_platform_ioremap_resource() in vsc73xx_platform_probe()

Quoted 8 lines · Markus Elfring

From: Markus Elfring <[email protected]>
Date: Fri, 20 Sep 2019 15:23:39 +0200

Simplify this function implementation by using a known wrapper function.

This issue was detected by using the Coccinelle software.

Andrew

#3 lore raw

PATCH 2/2 net: dsa: vsc73xx: Return an error code as a constant in vsc73xx_platform_probe()

In reply to Markus Elfring

From: Markus Elfring <[email protected]>
Date: Fri, 20 Sep 2019 16:07:07 +0200

* Return an error code without storing it in an intermediate variable.

* Delete the local variable “ret” which became unnecessary with this refactoring.

This issue was detected by using the Coccinelle software.

---
 drivers/net/dsa/vitesse-vsc73xx-platform.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/dsa/vitesse-vsc73xx-platform.c +1 -3
index a3bbf9bd1bf1..0ae8d904ca85 100644
@@ -89,7 +89,6 @@ static int vsc73xx_platform_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct vsc73xx_platform *vsc_platform;
-	int ret;
 
 	vsc_platform = devm_kzalloc(dev, sizeof(*vsc_platform), GFP_KERNEL);
 	if (!vsc_platform)
@@ -103,8 +102,7 @@ static int vsc73xx_platform_probe(struct platform_device *pdev)
 	vsc_platform->base_addr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(vsc_platform->base_addr)) {
 		dev_err(&pdev->dev, "cannot request I/O memory space\n");
-		ret = -ENXIO;
-		return ret;
+		return -ENXIO;
 	}
 
 	return vsc73xx_probe(&vsc_platform->vsc);

--
2.23.0

maintainer Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] net: dsa: vsc73xx: Return an error code as a constant in vsc73xx_platform_probe()

Quoted 11 lines · Markus Elfring

From: Markus Elfring <[email protected]>
Date: Fri, 20 Sep 2019 16:07:07 +0200

* Return an error code without storing it in an intermediate variable.

* Delete the local variable “ret” which became unnecessary with this refactoring.

This issue was detected by using the Coccinelle software.

Andrew

maintainer
#5 lore raw
In reply to Markus Elfring
Quoted 5 lines · Markus Elfring

From: Markus Elfring <[email protected]>
Date: Fri, 20 Sep 2019 16:17:18 +0200

Two update suggestions were taken into account
from static source code analysis.

Hi Markus

netdev is closed at the moment for patch. Please repost once it reopens, in about 2 weeks time.

Thanks
Andrew

#7 lore raw
Quoted 3 lines · Markus Elfring
Quoted 1 line

netdev is closed at the moment for patch.

I wonder about this information.

This is covered here:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/netdev-FAQ.rst#n40

and you can skip the reading and check this URL:

http://vger.kernel.org/~davem/net-next.html

Quoted 7 lines
Quoted 3 lines

Please repost once it reopens, in about 2 weeks time.

I hope that the presented change possibilities can be integrated in the near future also without a repetition of this small patch series.
https://lore.kernel.org/patchwork/project/lkml/list/?seriesA1271

You will have to resend it, and unless a bug fix comes in, which would be the only reason for your changes not to be "current" anymore, then it should apply as-is and you should be fine.

Signature · 1 line
Florian
#8 lore raw
Quoted 5 lines · Florian Fainelli
Quoted 3 lines · Markus Elfring
Quoted 1 line

netdev is closed at the moment for patch.

I wonder about this information.

Quoted 7 lines

This is covered here:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/netdev-FAQ.rst#n40

and you can skip the reading and check this URL:

http://vger.kernel.org/~davem/net-next.html

Indeed, looks like we have a mix of clean ups of varying clarity here. I will just drop all, including the devm_platform_ioremap_resource() conversion patches from patchwork for now.

Markus, please repost them all once net-next opens. Sorry for inconvenience.

#9 lore raw
Quoted 3 lines

Indeed, looks like we have a mix of clean ups of varying clarity here. I will just drop all, including the devm_platform_ioremap_resource() conversion patches from patchwork for now.

I would prefer an other patch management in this case.

Quoted 2 lines

Markus, please repost them all once net-next opens. Sorry for inconvenience.

I would find it nicer if presented change possibilities can be automatically reconsidered on demand after each closed period.
https://patchwork.ozlabs.org/project/netdev/list/?submitter=76334&state=*
https://patchwork.ozlabs.org/project/netdev/list/?submitter=65077&state=*&archive=both

Regards,
Markus