diff mbox series

[net-next] net: mdio: mscc-miim: Set back the optional resource.

Message ID 20211130095745.163287-1-horatiu.vultur@microchip.com (mailing list archive)
State Accepted
Commit c448c898ae890d966a48c8031b199fda9c6a1d93
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: mdio: mscc-miim: Set back the optional resource. | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 42 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Horatiu Vultur Nov. 30, 2021, 9:57 a.m. UTC
In the blamed commit, the second memory resource was not considered
anymore as optional. On some platforms like sparx5 the second resource
is optional. So add it back as optional and restore the comment that
says so.

Fixes: a27a762828375a ("net: mdio: mscc-miim: convert to a regmap implementation")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/net/mdio/mdio-mscc-miim.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Nov. 30, 2021, 12:30 p.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Tue, 30 Nov 2021 10:57:45 +0100 you wrote:
> In the blamed commit, the second memory resource was not considered
> anymore as optional. On some platforms like sparx5 the second resource
> is optional. So add it back as optional and restore the comment that
> says so.
> 
> Fixes: a27a762828375a ("net: mdio: mscc-miim: convert to a regmap implementation")
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> 
> [...]

Here is the summary with links:
  - [net-next] net: mdio: mscc-miim: Set back the optional resource.
    https://git.kernel.org/netdev/net-next/c/c448c898ae89

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c
index 2d420c9d7520..7d2abaf2b2c9 100644
--- a/drivers/net/mdio/mdio-mscc-miim.c
+++ b/drivers/net/mdio/mdio-mscc-miim.c
@@ -219,9 +219,10 @@  EXPORT_SYMBOL(mscc_miim_setup);
 
 static int mscc_miim_probe(struct platform_device *pdev)
 {
-	struct regmap *mii_regmap, *phy_regmap;
+	struct regmap *mii_regmap, *phy_regmap = NULL;
 	void __iomem *regs, *phy_regs;
 	struct mscc_miim_dev *miim;
+	struct resource *res;
 	struct mii_bus *bus;
 	int ret;
 
@@ -239,17 +240,21 @@  static int mscc_miim_probe(struct platform_device *pdev)
 		return PTR_ERR(mii_regmap);
 	}
 
-	phy_regs = devm_platform_ioremap_resource(pdev, 1);
-	if (IS_ERR(phy_regs)) {
-		dev_err(&pdev->dev, "Unable to map internal phy registers\n");
-		return PTR_ERR(phy_regs);
-	}
+	/* This resource is optional */
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	if (res) {
+		phy_regs = devm_ioremap_resource(&pdev->dev, res);
+		if (IS_ERR(phy_regs)) {
+			dev_err(&pdev->dev, "Unable to map internal phy registers\n");
+			return PTR_ERR(phy_regs);
+		}
 
-	phy_regmap = devm_regmap_init_mmio(&pdev->dev, phy_regs,
-					   &mscc_miim_regmap_config);
-	if (IS_ERR(phy_regmap)) {
-		dev_err(&pdev->dev, "Unable to create phy register regmap\n");
-		return PTR_ERR(phy_regmap);
+		phy_regmap = devm_regmap_init_mmio(&pdev->dev, phy_regs,
+						   &mscc_miim_regmap_config);
+		if (IS_ERR(phy_regmap)) {
+			dev_err(&pdev->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);