From: Romain Perier <romain.perier@gmail.com>
To: peppe.cavallaro@st.com
Cc: netdev@vger.kernel.org, linux-rockchip@lists.infradead.org
Subject: [PATCH] stmmac: Don't exit mdio registration when mdio subnode is not found in the DTS
Date: Tue, 29 Dec 2015 15:05:35 +0100 [thread overview]
Message-ID: <1451397935-23643-1-git-send-email-romain.perier@gmail.com> (raw)
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.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
---
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..0034de44 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 (IS_ENABLED(CONFIG_OF) && 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
next reply other threads:[~2015-12-29 14:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-29 14:05 Romain Perier [this message]
[not found] ` <1451397935-23643-1-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-01-02 5:51 ` [PATCH] stmmac: Don't exit mdio registration when mdio subnode is not found in the DTS Florian Fainelli
2016-01-02 15:11 ` Romain Perier
2016-01-02 17:52 ` Florian Fainelli
[not found] ` <56880E46.4050206-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-01-03 14:36 ` Romain Perier
2016-01-07 19:45 ` Florian Fainelli
2016-01-08 1:00 ` Phil Reid
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1451397935-23643-1-git-send-email-romain.perier@gmail.com \
--to=romain.perier@gmail.com \
--cc=linux-rockchip@lists.infradead.org \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).