linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net-next 0/1] mscc-miim probe cleanup
@ 2022-04-07 23:44 Colin Foster
  2022-04-07 23:44 ` [PATCH v2 net-next 1/1] net: mdio: mscc-miim: add local dev variable to cleanup probe function Colin Foster
  2022-04-09  3:40 ` [PATCH v2 net-next 0/1] mscc-miim probe cleanup patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Colin Foster @ 2022-04-07 23:44 UTC (permalink / raw)
  To: linux-kernel, netdev
  Cc: Paolo Abeni, Jakub Kicinski, David S. Miller, Russell King,
	Heiner Kallweit, Andrew Lunn, Vladimir Oltean, Florian Fainelli

I'm submitting this patch independently from my ongoing patch set to
include external control over Ocelot chips.

Initially the sole patch had reviewed-by tags from Vladimir Oltean and
Florian Fainelli, but since I had to manually resolve some conflicts I
removed the tags.

v1 > v2: Fix incorrect regmap config reference

Colin Foster (1):
  net: mdio: mscc-miim: add local dev variable to cleanup probe function

 drivers/net/mdio/mdio-mscc-miim.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 net-next 1/1] net: mdio: mscc-miim: add local dev variable to cleanup probe function
  2022-04-07 23:44 [PATCH v2 net-next 0/1] mscc-miim probe cleanup Colin Foster
@ 2022-04-07 23:44 ` Colin Foster
  2022-04-08 12:48   ` Vladimir Oltean
  2022-04-09  3:40 ` [PATCH v2 net-next 0/1] mscc-miim probe cleanup patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Colin Foster @ 2022-04-07 23:44 UTC (permalink / raw)
  To: linux-kernel, netdev
  Cc: Paolo Abeni, Jakub Kicinski, David S. Miller, Russell King,
	Heiner Kallweit, Andrew Lunn, Vladimir Oltean, Florian Fainelli

Create a local device *dev in order to not dereference the platform_device
several times throughout the probe function.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
---
 drivers/net/mdio/mdio-mscc-miim.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c
index c3d1a7eaec41..8bfa81123e30 100644
--- a/drivers/net/mdio/mdio-mscc-miim.c
+++ b/drivers/net/mdio/mdio-mscc-miim.c
@@ -266,6 +266,7 @@ static int mscc_miim_probe(struct platform_device *pdev)
 {
 	struct regmap *mii_regmap, *phy_regmap = NULL;
 	struct device_node *np = pdev->dev.of_node;
+	struct device *dev = &pdev->dev;
 	void __iomem *regs, *phy_regs;
 	struct mscc_miim_dev *miim;
 	struct resource *res;
@@ -274,57 +275,55 @@ static int mscc_miim_probe(struct platform_device *pdev)
 
 	regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
 	if (IS_ERR(regs)) {
-		dev_err(&pdev->dev, "Unable to map MIIM registers\n");
+		dev_err(dev, "Unable to map MIIM registers\n");
 		return PTR_ERR(regs);
 	}
 
-	mii_regmap = devm_regmap_init_mmio(&pdev->dev, regs,
-					   &mscc_miim_regmap_config);
+	mii_regmap = devm_regmap_init_mmio(dev, regs, &mscc_miim_regmap_config);
 
 	if (IS_ERR(mii_regmap)) {
-		dev_err(&pdev->dev, "Unable to create MIIM regmap\n");
+		dev_err(dev, "Unable to create MIIM regmap\n");
 		return PTR_ERR(mii_regmap);
 	}
 
 	/* This resource is optional */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 	if (res) {
-		phy_regs = devm_ioremap_resource(&pdev->dev, res);
+		phy_regs = devm_ioremap_resource(dev, res);
 		if (IS_ERR(phy_regs)) {
-			dev_err(&pdev->dev, "Unable to map internal phy registers\n");
+			dev_err(dev, "Unable to map internal phy registers\n");
 			return PTR_ERR(phy_regs);
 		}
 
-		phy_regmap = devm_regmap_init_mmio(&pdev->dev, phy_regs,
+		phy_regmap = devm_regmap_init_mmio(dev, phy_regs,
 						   &mscc_miim_phy_regmap_config);
 		if (IS_ERR(phy_regmap)) {
-			dev_err(&pdev->dev, "Unable to create phy register regmap\n");
+			dev_err(dev, "Unable to create phy register regmap\n");
 			return PTR_ERR(phy_regmap);
 		}
 	}
 
-	ret = mscc_miim_setup(&pdev->dev, &bus, "mscc_miim", mii_regmap, 0);
+	ret = mscc_miim_setup(dev, &bus, "mscc_miim", mii_regmap, 0);
 	if (ret < 0) {
-		dev_err(&pdev->dev, "Unable to setup the MDIO bus\n");
+		dev_err(dev, "Unable to setup the MDIO bus\n");
 		return ret;
 	}
 
 	miim = bus->priv;
 	miim->phy_regs = phy_regmap;
 
-	miim->info = device_get_match_data(&pdev->dev);
+	miim->info = device_get_match_data(dev);
 	if (!miim->info)
 		return -EINVAL;
 
-	miim->clk = devm_clk_get_optional(&pdev->dev, NULL);
+	miim->clk = devm_clk_get_optional(dev, NULL);
 	if (IS_ERR(miim->clk))
 		return PTR_ERR(miim->clk);
 
 	of_property_read_u32(np, "clock-frequency", &miim->bus_freq);
 
 	if (miim->bus_freq && !miim->clk) {
-		dev_err(&pdev->dev,
-			"cannot use clock-frequency without a clock\n");
+		dev_err(dev, "cannot use clock-frequency without a clock\n");
 		return -EINVAL;
 	}
 
@@ -338,7 +337,7 @@ static int mscc_miim_probe(struct platform_device *pdev)
 
 	ret = of_mdiobus_register(bus, np);
 	if (ret < 0) {
-		dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret);
+		dev_err(dev, "Cannot register MDIO bus (%d)\n", ret);
 		goto out_disable_clk;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 net-next 1/1] net: mdio: mscc-miim: add local dev variable to cleanup probe function
  2022-04-07 23:44 ` [PATCH v2 net-next 1/1] net: mdio: mscc-miim: add local dev variable to cleanup probe function Colin Foster
@ 2022-04-08 12:48   ` Vladimir Oltean
  0 siblings, 0 replies; 4+ messages in thread
From: Vladimir Oltean @ 2022-04-08 12:48 UTC (permalink / raw)
  To: Colin Foster
  Cc: linux-kernel, netdev, Paolo Abeni, Jakub Kicinski,
	David S. Miller, Russell King, Heiner Kallweit, Andrew Lunn,
	Florian Fainelli

On Thu, Apr 07, 2022 at 04:44:45PM -0700, Colin Foster wrote:
> Create a local device *dev in order to not dereference the platform_device
> several times throughout the probe function.
> 
> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 net-next 0/1] mscc-miim probe cleanup
  2022-04-07 23:44 [PATCH v2 net-next 0/1] mscc-miim probe cleanup Colin Foster
  2022-04-07 23:44 ` [PATCH v2 net-next 1/1] net: mdio: mscc-miim: add local dev variable to cleanup probe function Colin Foster
@ 2022-04-09  3:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-04-09  3:40 UTC (permalink / raw)
  To: Colin Foster
  Cc: linux-kernel, netdev, pabeni, kuba, davem, linux, hkallweit1,
	andrew, vladimir.oltean, f.fainelli

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Thu,  7 Apr 2022 16:44:44 -0700 you wrote:
> I'm submitting this patch independently from my ongoing patch set to
> include external control over Ocelot chips.
> 
> Initially the sole patch had reviewed-by tags from Vladimir Oltean and
> Florian Fainelli, but since I had to manually resolve some conflicts I
> removed the tags.
> 
> [...]

Here is the summary with links:
  - [v2,net-next,1/1] net: mdio: mscc-miim: add local dev variable to cleanup probe function
    https://git.kernel.org/netdev/net-next/c/626a5aaa5067

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-09  3:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07 23:44 [PATCH v2 net-next 0/1] mscc-miim probe cleanup Colin Foster
2022-04-07 23:44 ` [PATCH v2 net-next 1/1] net: mdio: mscc-miim: add local dev variable to cleanup probe function Colin Foster
2022-04-08 12:48   ` Vladimir Oltean
2022-04-09  3:40 ` [PATCH v2 net-next 0/1] mscc-miim probe cleanup patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).