From patchwork Tue May 15 23:56:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10402343 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 24A44600F4 for ; Tue, 15 May 2018 23:58:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C90B120415 for ; Tue, 15 May 2018 23:58:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB3C8201F5; Tue, 15 May 2018 23:58:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 650781FF13 for ; Tue, 15 May 2018 23:58:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752638AbeEOX5r (ORCPT ); Tue, 15 May 2018 19:57:47 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:41703 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751402AbeEOX4d (ORCPT ); Tue, 15 May 2018 19:56:33 -0400 Received: by mail-pg0-f65.google.com with SMTP id w4-v6so735886pgq.8; Tue, 15 May 2018 16:56:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eJZ/fQb+z/sby1KxqgytfROibB91x+IdLHNyI9CaYTU=; b=mPHRGVALErpoLuYnDprPVhwvbe2I01cehdfJ2aP40ngBVVbmD7yd8fDxK0uw8axZFk S/goWKliWsha/v0lAdMIZSAH/M+jwpfXQ0/qmekFgqQsnsVGiE7aV21TO+xm4JdcKhpQ VGR/NJmd0RqsQzMId7SFqu5+DfHR+K98obWGWHsazRKFh7iOeMKgiAZQP1dq62VFxhxE sg0CmprdY7QbI7qxgEF+EsW1wA1rcPYMi2EvqMGYJLIerKKGg4yT/YC6P6erkUKomGtu r/17g7FusmCkshd7om/uvK0KaCVNM2M8KoChLT6XW3wSrZyexIDVA6424Gj5CYS2N04g dMaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eJZ/fQb+z/sby1KxqgytfROibB91x+IdLHNyI9CaYTU=; b=ehnOHfJwI4sMAbGEl+zk/KwQkDqPspoOz3lhh7DKfn7+JTVjQ+iNVn7eMhhmwgTen3 8eAtOqrO2hZxfI0MpKZTD91X0uMvqhxE6+zcxelR92KAvjgARL+sb/xubktTismXkGub /7JASakEPI/74nOi3d63U/Gtg3G1EcNRBNvoY6jYkWIdRyxvQ09QXeX3/UqvJrrFt8j+ Ur1oEIoVzFH7ziAucm5w9nR8ckA6E5wL3GBy+ZemkB3tI/3ss86FN2OPOzfzr2Ttr/fj 8OJcBeErGjr6PQh5INQo0dG9/edfO/iTJ9B543rU1KKfO32wGh7ckPM5Dyy6TE/4Fjl8 vS4A== X-Gm-Message-State: ALKqPweBLgg0j1Lj+be1G0OtdOxTfiIv01hLhkZZ6XmsIr9+wxNZOsab BsiLg+aJMX6ronKf6yDJqGcBNtFo X-Google-Smtp-Source: AB8JxZo5caIYN2oN1cVWUWdYkDo30OKEEqRyGX6pdUeANd2Meg3WG/q/popMaztFEH+uFSHxixTX/Q== X-Received: by 2002:a62:c205:: with SMTP id l5-v6mr17142658pfg.6.1526428592794; Tue, 15 May 2018 16:56:32 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id r22-v6sm1321856pfh.61.2018.05.15.16.56.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 16:56:31 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org 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 , Geert Uytterhoeven , Thomas Petazzoni , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Simon Horman , Maxim Uvarov , Sekhar Nori , 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 v2 1/2] of: mdio: Fall back to mdiobus_register() with NULL device_node Date: Tue, 15 May 2018 16:56:18 -0700 Message-Id: <20180515235619.27773-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515235619.27773-1-f.fainelli@gmail.com> References: <20180515235619.27773-1-f.fainelli@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the device_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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 8c0c92712fc9..d963baf8e53a 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -204,6 +204,9 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) bool scanphys = false; int addr, rc; + if (!np) + return mdiobus_register(mdio); + /* Do not continue if the node is disabled */ if (!of_device_is_available(np)) return -ENODEV;