From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: "Florian Fainelli" <f.fainelli@gmail.com>,
"Andrew Lunn" <andrew@lunn.ch>,
"Vivien Didelot" <vivien.didelot@savoirfairelinux.com>,
"David S. Miller" <davem@davemloft.net>,
"Nicolas Ferre" <nicolas.ferre@microchip.com>,
"Fugang Duan" <fugang.duan@nxp.com>,
"Sergei Shtylyov" <sergei.shtylyov@cogentembedded.com>,
"Giuseppe Cavallaro" <peppe.cavallaro@st.com>,
"Alexandre Torgue" <alexandre.torgue@st.com>,
"Jose Abreu" <joabreu@synopsys.com>,
"Grygorii Strashko" <grygorii.strashko@ti.com>,
"Woojung Huh" <woojung.huh@microchip.com>,
"Microchip Linux Driver Support" <UNGLinuxDriver@microchip.com>,
"Rob Herring" <robh+dt@kernel.org>,
"Frank Rowand" <frowand.list@gmail.com>,
"Antoine Tenart" <antoine.tenart@free-electrons.com>,
"Tobias Jordan" <Tobias.Jordan@elektrobit.com>,
"Russell King" <rmk+kernel@armlinux.org.uk>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>,
"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
"Simon Horman" <horms+renesas@verge.net.au>,
"Maxim Uvarov" <muvarov@gmail.com>,
"Sekhar Nori" <nsekhar@ti.com>,
linux-kernel@vger.kernel.org (open list),
linux-renesas-soc@vger.kernel.org (open list:RENESAS ETHERNET
DRIVERS),
linux-omap@vger.kernel.org (open list:TI ETHERNET SWITCH DRIVER
(CPSW)),
linux-usb@vger.kernel.org (open list:USB NETWORKING DRIVERS),
devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND
FLATTENED DEVICE TREE)
Subject: [PATCH net-next 1/2] of: mdio: Fall back to mdiobus_register() with np is NULL
Date: Tue, 15 May 2018 14:59:29 -0700 [thread overview]
Message-ID: <20180515215930.12115-2-f.fainelli@gmail.com> (raw)
In-Reply-To: <20180515215930.12115-1-f.fainelli@gmail.com>
When the Device Tree node specified is NULL, fall back to
mdiobus_register(). We have a number of drivers having a similar pattern
which is:
if (np)
of_mdiobus_register()
else
mdiobus_register()
so incorporate that behavior within the core of_mdiobus_register()
function. This is also consistent with the stub version that we defined
when CONFIG_OF=n.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/of/of_mdio.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index 8c0c92712fc9..2341dbf675bf 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -204,6 +204,12 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
bool scanphys = false;
int addr, rc;
+ /* If the Device Tree node does not exist, fall back to traditional
+ * registration
+ */
+ if (!np)
+ return mdiobus_register(mdio);
+
/* Do not continue if the node is disabled */
if (!of_device_is_available(np))
return -ENODEV;
--
2.14.1
next prev parent reply other threads:[~2018-05-15 21:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-15 21:59 [PATCH net-next 0/2] of: mdio: Fall back to mdiobus_register() with np is NULL Florian Fainelli
2018-05-15 21:59 ` Florian Fainelli [this message]
2018-05-15 21:59 ` [PATCH net-next 2/2] drivers: net: Remove device_node checks with of_mdiobus_register() Florian Fainelli
2018-05-15 22:57 ` Grygorii Strashko
2018-05-15 22:59 ` Florian Fainelli
2018-05-16 16:33 ` kbuild test robot
2018-05-16 17:05 ` kbuild test robot
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=20180515215930.12115-2-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=Tobias.Jordan@elektrobit.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.torgue@st.com \
--cc=andrew@lunn.ch \
--cc=antoine.tenart@free-electrons.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=fugang.duan@nxp.com \
--cc=geert+renesas@glider.be \
--cc=grygorii.strashko@ti.com \
--cc=horms+renesas@verge.net.au \
--cc=joabreu@synopsys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=muvarov@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=nsekhar@ti.com \
--cc=peppe.cavallaro@st.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=robh+dt@kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=thomas.petazzoni@free-electrons.com \
--cc=vivien.didelot@savoirfairelinux.com \
--cc=woojung.huh@microchip.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