* [PATCH v2] stmmac: Don't exit mdio registration when mdio subnode is not found in the DTS
@ 2016-01-07 20:13 Romain Perier
2016-01-08 8:04 ` Phil Reid
2016-01-10 23:03 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Romain Perier @ 2016-01-07 20:13 UTC (permalink / raw)
To: peppe.cavallaro; +Cc: netdev, linux-rockchip
Originally, most of the platforms using this driver did not define an mdio subnode
in the devicetree. Commit e34d65 ("stmmac: create of compatible mdio bus for stmmac driver")
introduced a backward compatibily issue by using of_mdiobus_register explicitly
with an mdio subnode. This patch fixes the issue by calling the function
mdiobus_register, when mdio subnode is not found. The driver is now compatible
with both modes.
Fixes: e34d65696d2e ("stmmac: create of compatible mdio bus for stmmac driver")
Signed-off-by: Romain Perier <romain.perier@gmail.com>
---
Changes in v2:
- Removed IS_ENABLED macro from the if statement before calling
of_mdiobus_register.
- Added Fixes tag in commit message
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 16c85cc..648488d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -218,8 +218,7 @@ int stmmac_mdio_register(struct net_device *ndev)
if (mdio_node) {
netdev_dbg(ndev, "FOUND MDIO subnode\n");
} else {
- netdev_err(ndev, "NO MDIO subnode\n");
- return 0;
+ netdev_warn(ndev, "No MDIO subnode found\n");
}
}
@@ -251,7 +250,10 @@ int stmmac_mdio_register(struct net_device *ndev)
new_bus->phy_mask = mdio_bus_data->phy_mask;
new_bus->parent = priv->device;
- err = of_mdiobus_register(new_bus, mdio_node);
+ if (mdio_node)
+ err = of_mdiobus_register(new_bus, mdio_node);
+ else
+ err = mdiobus_register(new_bus);
if (err != 0) {
pr_err("%s: Cannot register as MDIO bus\n", new_bus->name);
goto bus_register_fail;
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] stmmac: Don't exit mdio registration when mdio subnode is not found in the DTS
2016-01-07 20:13 [PATCH v2] stmmac: Don't exit mdio registration when mdio subnode is not found in the DTS Romain Perier
@ 2016-01-08 8:04 ` Phil Reid
2016-01-10 23:03 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Phil Reid @ 2016-01-08 8:04 UTC (permalink / raw)
To: peppe.cavallaro; +Cc: netdev, linux-rockchip
On 8/01/2016 4:13 AM, Romain Perier wrote:
> Originally, most of the platforms using this driver did not define an mdio subnode
> in the devicetree. Commit e34d65 ("stmmac: create of compatible mdio bus for stmmac driver")
> introduced a backward compatibily issue by using of_mdiobus_register explicitly
> with an mdio subnode. This patch fixes the issue by calling the function
> mdiobus_register, when mdio subnode is not found. The driver is now compatible
> with both modes.
>
> Fixes: e34d65696d2e ("stmmac: create of compatible mdio bus for stmmac driver")
> Signed-off-by: Romain Perier <romain.perier@gmail.com>
> ---
>
> Changes in v2:
> - Removed IS_ENABLED macro from the if statement before calling
> of_mdiobus_register.
> - Added Fixes tag in commit message
>
> drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> index 16c85cc..648488d 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> @@ -218,8 +218,7 @@ int stmmac_mdio_register(struct net_device *ndev)
> if (mdio_node) {
> netdev_dbg(ndev, "FOUND MDIO subnode\n");
> } else {
> - netdev_err(ndev, "NO MDIO subnode\n");
> - return 0;
> + netdev_warn(ndev, "No MDIO subnode found\n");
> }
> }
>
> @@ -251,7 +250,10 @@ int stmmac_mdio_register(struct net_device *ndev)
> new_bus->phy_mask = mdio_bus_data->phy_mask;
> new_bus->parent = priv->device;
>
> - err = of_mdiobus_register(new_bus, mdio_node);
> + if (mdio_node)
> + err = of_mdiobus_register(new_bus, mdio_node);
> + else
> + err = mdiobus_register(new_bus);
> if (err != 0) {
> pr_err("%s: Cannot register as MDIO bus\n", new_bus->name);
> goto bus_register_fail;
>
Tested-by: Phil Reid <preid@electromag.com.au>
--
Regards
Phil Reid
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] stmmac: Don't exit mdio registration when mdio subnode is not found in the DTS
2016-01-07 20:13 [PATCH v2] stmmac: Don't exit mdio registration when mdio subnode is not found in the DTS Romain Perier
2016-01-08 8:04 ` Phil Reid
@ 2016-01-10 23:03 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-01-10 23:03 UTC (permalink / raw)
To: romain.perier; +Cc: peppe.cavallaro, netdev, linux-rockchip
From: Romain Perier <romain.perier@gmail.com>
Date: Thu, 7 Jan 2016 21:13:28 +0100
> Originally, most of the platforms using this driver did not define an mdio subnode
> in the devicetree. Commit e34d65 ("stmmac: create of compatible mdio bus for stmmac driver")
> introduced a backward compatibily issue by using of_mdiobus_register explicitly
> with an mdio subnode. This patch fixes the issue by calling the function
> mdiobus_register, when mdio subnode is not found. The driver is now compatible
> with both modes.
>
> Fixes: e34d65696d2e ("stmmac: create of compatible mdio bus for stmmac driver")
> Signed-off-by: Romain Perier <romain.perier@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-10 23:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-07 20:13 [PATCH v2] stmmac: Don't exit mdio registration when mdio subnode is not found in the DTS Romain Perier
2016-01-08 8:04 ` Phil Reid
2016-01-10 23:03 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.