From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli 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 Message-ID: <20180515215930.12115-2-f.fainelli@gmail.com> References: <20180515215930.12115-1-f.fainelli@gmail.com> Cc: Florian Fainelli , Andrew Lunn , Vivien Didelot , "David S. Miller" , Nicolas Ferre , Fugang Duan , Sergei Shtylyov , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Grygorii Strashko , Woojung Huh , Microchip Linux Driver Support , Rob Herring , Frank Rowand , Antoine Tenart , Tobias Jordan , Russell King Received: from mail-qt0-f194.google.com ([209.85.216.194]:37464 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751728AbeEOV7l (ORCPT ); Tue, 15 May 2018 17:59:41 -0400 In-Reply-To: <20180515215930.12115-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: 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 --- 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