public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] [net-next] ARM: orion: fix PHYLIB dependency
Date: Thu,  9 Feb 2017 16:08:11 +0100	[thread overview]
Message-ID: <20170209150834.1158193-1-arnd@arndb.de> (raw)

The newly introduced mdiobus_register_board_info() function is only available
as part of PHYLIB, so we get a link error when we call that from a board while
phylib is disabled:

arch/arm/plat-orion/common.o: In function `orion_ge00_switch_init':
common.c:(.init.text+0x6a4): undefined reference to `mdiobus_register_board_info'

This adds a workaround that is made up of three parts:

- in plat-orion, the function for declaring the switch is hidden without
  PHYLIB.
- in mach-orion5x, the caller conditionally stubs out the call to
  the removed function, so we can still build other orion5x boards
  without PHYLIB
- For the boards that actually declare the switch, we select PHYLIB
  explicitly from Kconfig if NETDEVICES is set. Without NETDEVICES,
  we cannot enable PHYLIB, but we also wouldn't need it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-orion5x/Kconfig  | 5 +++++
 arch/arm/mach-orion5x/common.c | 4 ++--
 arch/arm/plat-orion/common.c   | 2 ++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
index 468b8cb7fd5f..b98a0057ef66 100644
--- a/arch/arm/mach-orion5x/Kconfig
+++ b/arch/arm/mach-orion5x/Kconfig
@@ -107,6 +107,7 @@ config MACH_TS409
 
 config MACH_WRT350N_V2
 	bool "Linksys WRT350N v2"
+	select PHYLIB if NETDEVICES
 	help
 	  Say 'Y' here if you want your kernel to support the
 	  Linksys WRT350N v2 platform.
@@ -146,24 +147,28 @@ config MACH_MSS2_DT
 
 config MACH_WNR854T
 	bool "Netgear WNR854T"
+	select PHYLIB if NETDEVICES
 	help
 	  Say 'Y' here if you want your kernel to support the
 	  Netgear WNR854T platform.
 
 config MACH_RD88F5181L_GE
 	bool "Marvell Orion-VoIP GE Reference Design"
+	select PHYLIB if NETDEVICES
 	help
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell Orion-VoIP GE (88F5181L) RD.
 
 config MACH_RD88F5181L_FXO
 	bool "Marvell Orion-VoIP FXO Reference Design"
+	select PHYLIB if NETDEVICES
 	help
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell Orion-VoIP FXO (88F5181L) RD.
 
 config MACH_RD88F6183AP_GE
 	bool "Marvell Orion-1-90 AP GE Reference Design"
+	select PHYLIB if NETDEVICES
 	help
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell Orion-1-90 (88F6183) AP GE RD.
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 83a7ec4c16d0..e712c5adaf87 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -107,10 +107,10 @@ void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
  ****************************************************************************/
 void __init orion5x_eth_switch_init(struct dsa_chip_data *d)
 {
-	orion_ge00_switch_init(d);
+	if (IS_BUILTIN(CONFIG_PHYLIB))
+		orion_ge00_switch_init(d);
 }
 
-
 /*****************************************************************************
  * I2C
  ****************************************************************************/
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index 9255b6d67ba5..ab5af56f9b9d 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -471,6 +471,7 @@ void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
 /*****************************************************************************
  * Ethernet switch
  ****************************************************************************/
+#if IS_BUILTIN(CONFIG_PHYLIB)
 static __initconst const char *orion_ge00_mvmdio_bus_name = "orion-mii";
 static __initdata struct mdio_board_info
 		  orion_ge00_switch_board_info;
@@ -493,6 +494,7 @@ void __init orion_ge00_switch_init(struct dsa_chip_data *d)
 
 	mdiobus_register_board_info(&orion_ge00_switch_board_info, 1);
 }
+#endif
 
 /*****************************************************************************
  * I2C
-- 
2.9.0

             reply	other threads:[~2017-02-09 15:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09 15:08 Arnd Bergmann [this message]
2017-02-09 15:57 ` [PATCH] [net-next] ARM: orion: fix PHYLIB dependency Andrew Lunn
2017-02-09 17:14   ` Arnd Bergmann
2017-02-09 17:20     ` Andrew Lunn
2017-02-09 18:14       ` Florian Fainelli
2017-02-09 17:22 ` Andrew Lunn
2017-02-09 18:22 ` Florian Fainelli
2017-02-10  8:20   ` Arnd Bergmann
2017-02-10 17:42     ` Florian Fainelli
2017-02-10 20:05       ` Arnd Bergmann
2017-02-10 20:57         ` Florian Fainelli
2017-02-10 21:32           ` Arnd Bergmann
2017-02-13 14:31             ` Arnd Bergmann

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=20170209150834.1158193-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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