From patchwork Fri Jun 24 09:24:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102102 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp848575qgy; Fri, 24 Jun 2016 02:23:04 -0700 (PDT) X-Received: by 10.98.25.66 with SMTP id 63mr5487792pfz.94.1466760183991; Fri, 24 Jun 2016 02:23:03 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gu9si5362100pac.71.2016.06.24.02.23.03; Fri, 24 Jun 2016 02:23:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751672AbcFXJXB (ORCPT + 7 others); Fri, 24 Jun 2016 05:23:01 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:59693 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751080AbcFXJW7 (ORCPT ); Fri, 24 Jun 2016 05:22:59 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue103) with ESMTPA (Nemesis) id 0LlYpT-1bpA2U1y6h-00bNea; Fri, 24 Jun 2016 11:22:37 +0200 From: Arnd Bergmann To: Florian Fainelli Cc: Arnd Bergmann , Rob Herring , Frank Rowand , David Daney , "David S. Miller" , Andrew Lunn , Sergei Shtylyov , Ben Hutchings , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH] of_mdio: select fixed phy support unconditionally Date: Fri, 24 Jun 2016 11:24:08 +0200 Message-Id: <20160624092450.1507991-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:G8iF1OOlAGUBivvNJBrX2LVWbpVyc5+G6BTlpvVyN5YdPOW76H2 nvIHj6CEyU+qze9uU90DZQjcZrCDTsu0uvQ+6xOZt6ogw9/omF1yHbgs/0msg/0sDKDngR8 f5KUQgATVtvZF2CSzOkH6cplKfTYfMjO8Z73QBvK6L8pCbIe0m8WSbozGSS1SiK+rkMbqO4 eJD6m5RM/XTDGsyD/7YDw== X-UI-Out-Filterresults: notjunk:1; V01:K0:wKV/A2W8NoM=:lJ+iafOUNW85yNELqfpynT xwLSG20+75QEwM0LkSd7Ebl+aIEKJp4rfJCrsKh/MYe2B7zqnRs5rE5oPbNgNZL2VM06Tn1eD zMsBgulfOOVm+ScPqJUYBQMBKepL61cgUOM//a8mV+HTxmKoHyfwyzM3H8zl7TuSZCLrnzAQL 7CiDM3WhaYptYxFm1IMetZF0j41l9PQnXkKgl2Pi9YbGf7YpgbPf+DQKRS9uypSijsYk49FIy x/ufSBzqmGnh6OijQIsOCnnbyDX0HQyo/RKtfPiMbl1IODpQzBAVkhIjhRoa8JfT3nZtP9Opf Ezg90NFtJMIdxB7tvFUVd1wMu66J7i6dn9+Af4tNuJvII9ydLuGD688LFtFnR/gexqP+NcZ6L 5I3ZnOvaSOauwnJ6v3P7X+qmr96fO4ap1qnWI625ihY9u9QKajB5/s6mJ5N32m42NTV483c/j ttr7PnfASSC28ddAspqnXQwEXU94JoNBJQFVmjg/gvDG7gDvfA61MCCdiwBmOka9PGUCzECY4 nD2t05seTQrEqVtlymKFL66xNP8mSmKskMug75u7HFnGIFjZqWa8OrvrEea72lxMFhIASFPbf F8CgClQV9aYis+cdZN2N009wCMW/Fa+DK+ttFmluRAqJCfXRujz3kQmTQxeznj0UyoQIH8d3Z lNb5wY4G1a0vJWOqT1a8mM8qoyRQrfiKmsVMwMiHLy6QMI3VAtdmIIdTrtp77vhVFdzQ= Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Calling the fixed-phy functions when CONFIG_FIXED_PHY=m as a previous change tried cannot work if the caller is in built-in code: drivers/of/built-in.o: In function `of_phy_register_fixed_link': of_reserved_mem.c:(.text+0x85e0): undefined reference to `fixed_phy_register' Making of_mdio depend on 'FIXED_PHY || !FIXED_PHY' would solve this dependency by enforcing that OF_MDIO itself becomes a loadable module when FIXED_PHY=y, but that creates a different dependency as it breaks any built-in ethernet driver that uses of_mdio. Making FIXED_PHY a bool option also cannot work, since it depends on PHYLIB, which again is tristate. This version now uses 'select FIXED_PHY' to ensure that the fixed-phy portion of of_mdio is not optional. The main downside of this is a small increase in code size for cases that do not need fixed phy support, but it should avoid all of the link-time problems. Signed-off-by: Arnd Bergmann Fixes: d1bd330a229f ("of_mdio: Enable fixed PHY support if driver is a module") --- drivers/of/Kconfig | 1 + drivers/of/of_mdio.c | 2 -- include/linux/of_mdio.h | 8 ++------ 3 files changed, 3 insertions(+), 8 deletions(-) -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index b3bec3aaa45d..bc07ad30c9bf 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig @@ -74,6 +74,7 @@ config OF_NET config OF_MDIO def_tristate PHYLIB depends on PHYLIB + select FIXED_PHY help OpenFirmware MDIO bus (Ethernet PHY) accessors diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index de68707a99c7..e2b50bc12f23 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -361,7 +361,6 @@ struct phy_device *of_phy_attach(struct net_device *dev, } EXPORT_SYMBOL(of_phy_attach); -#if IS_ENABLED(CONFIG_FIXED_PHY) /* * of_phy_is_fixed_link() and of_phy_register_fixed_link() must * support two DT bindings: @@ -451,4 +450,3 @@ int of_phy_register_fixed_link(struct device_node *np) return -ENODEV; } EXPORT_SYMBOL(of_phy_register_fixed_link); -#endif diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h index 6c8cb9aa4c00..4b04587d0441 100644 --- a/include/linux/of_mdio.h +++ b/include/linux/of_mdio.h @@ -25,6 +25,8 @@ struct phy_device *of_phy_attach(struct net_device *dev, extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); extern int of_mdio_parse_addr(struct device *dev, const struct device_node *np); +extern int of_phy_register_fixed_link(struct device_node *np); +extern bool of_phy_is_fixed_link(struct device_node *np); #else /* CONFIG_OF */ static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) @@ -67,12 +69,6 @@ static inline int of_mdio_parse_addr(struct device *dev, { return -ENOSYS; } -#endif /* CONFIG_OF */ - -#if defined(CONFIG_OF) && IS_ENABLED(CONFIG_FIXED_PHY) -extern int of_phy_register_fixed_link(struct device_node *np); -extern bool of_phy_is_fixed_link(struct device_node *np); -#else static inline int of_phy_register_fixed_link(struct device_node *np) { return -ENOSYS;