Skip to contentSkip to conversation

usb: phy: add USB_SUPPORT dependency

PATCH Applied Arnd Bergmann 3 participants 7 messages Sep 6, 2016 – Sep 14, 2016 Generic PHY framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: phy: add USB_SUPPORT dependency

The driver now calls of_usb_get_dr_mode_by_phy, which is part of the USB core layer, and it fails to build when that is not provided:

drivers/phy/phy-sun4i-usb.o: In function `sun4i_usb_phy_probe':
phy-sun4i-usb.c:(.text.sun4i_usb_phy_probe+0x140): undefined reference to `of_usb_get_dr_mode_by_phy'

We already have a couple of other PHY drivers with a dependency on USB_SUPPORT, so that seems to be the easiest fix here.

An alternative would be to adjust the #ifdef in include/linux/usb/of.h to also check for CONFIG_USB_SUPPORT.

Fixes b33ecca87df9 ("phy-sun4i-usb: Add support for peripheral-only mode")
---
 drivers/phy/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/phy/Kconfig +1 -0
index c42ddf3c8ed8..985dff8558e5 100644
@@ -260,6 +260,7 @@ config PHY_SUN4I_USB
 	depends on RESET_CONTROLLER
 	depends on EXTCON
 	depends on POWER_SUPPLY
+	depends on USB_SUPPORT
 	select GENERIC_PHY
 	help
 	  Enable this to support the transceiver that is part of Allwinner
Signature · 1 line
2.9.0
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 6 lines · Arnd Bergmann

The driver now calls of_usb_get_dr_mode_by_phy, which is part of the USB core layer, and it fails to build when that is not provided:

drivers/phy/phy-sun4i-usb.o: In function `sun4i_usb_phy_probe':
phy-sun4i-usb.c:(.text.sun4i_usb_phy_probe+0x140): undefined reference to `of_usb_get_dr_mode_by_phy'

Quoted 8 lines

We already have a couple of other PHY drivers with a dependency on USB_SUPPORT, so that seems to be the easiest fix here.

An alternative would be to adjust the #ifdef in include/linux/usb/of.h to also check for CONFIG_USB_SUPPORT.

Fixes b33ecca87df9 ("phy-sun4i-usb: Add support for peripheral-only mode")

Good catch, patch LGTM:

Regards,

Hans

Quoted 17 lines
---
 drivers/phy/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/phy/Kconfig +1 -0
index c42ddf3c8ed8..985dff8558e5 100644
@@ -260,6 +260,7 @@ config PHY_SUN4I_USB
 	depends on RESET_CONTROLLER
 	depends on EXTCON
 	depends on POWER_SUPPLY
+	depends on USB_SUPPORT
 	select GENERIC_PHY
 	help
 	  Enable this to support the transceiver that is part of Allwinner
#2 lore raw
Quoted 16 lines · Hans de Goede

Hi,

Quoted 13 lines · Arnd Bergmann

The driver now calls of_usb_get_dr_mode_by_phy, which is part of the USB core layer, and it fails to build when that is not provided:

drivers/phy/phy-sun4i-usb.o: In function `sun4i_usb_phy_probe':
phy-sun4i-usb.c:(.text.sun4i_usb_phy_probe+0x140): undefined reference to `of_usb_get_dr_mode_by_phy'

We already have a couple of other PHY drivers with a dependency on USB_SUPPORT, so that seems to be the easiest fix here.

An alternative would be to adjust the #ifdef in include/linux/usb/of.h to also check for CONFIG_USB_SUPPORT.

Quoted 6 lines
Quoted 2 lines
Fixes b33ecca87df9 ("phy-sun4i-usb: Add support for peripheral-only mode")

Good catch, patch LGTM:

merged, thanks.

-Kishon

Quoted 24 lines

Regards,

Hans

Quoted 17 lines
---
 drivers/phy/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/phy/Kconfig +1 -0
index c42ddf3c8ed8..985dff8558e5 100644
@@ -260,6 +260,7 @@ config PHY_SUN4I_USB
     depends on RESET_CONTROLLER
     depends on EXTCON
     depends on POWER_SUPPLY
+    depends on USB_SUPPORT
     select GENERIC_PHY
     help
       Enable this to support the transceiver that is part of Allwinner
#3 lore raw

PATCH 1/1 phy-sun4i-usb: select 'USB_COMMON'

In commit "usb: phy: add USB_SUPPORT dependency", I tried to fix the dependency for this driver, but unfortunately I missed that we need both USB_COMMON and USB_SUPPORT here, and we can still get the same link error in the much rarer case that USB_COMMON is a loadable module and the phy driver is build-in:

drivers/phy/phy-sun4i-usb.o: In function `sun4i_usb_phy_probe':
phy-sun4i-usb.c:(.text.sun4i_usb_phy_probe+0x1a6): undefined reference to `of_usb_get_dr_mode_by_phy'

This adds the select, hopefully fixing it properly this time.

---
I see the original patch hasn't made it into linux-next yet, so ideally just fold this patch into the first one.

Sorry for not getting it right the first time around.

drivers/phy/Kconfig +1 -0
index 985dff8558e5..c717f306d131 100644
@@ -262,6 +262,7 @@ config PHY_SUN4I_USB
 	depends on POWER_SUPPLY
 	depends on USB_SUPPORT
 	select GENERIC_PHY
+	select USB_COMMON
 	help
 	  Enable this to support the transceiver that is part of Allwinner
 	  sunxi SoCs.
Reviewed-by on v1 1/1
#4 lore raw

Re: [PATCH] phy-sun4i-usb: select 'USB_COMMON'

Hi,

Quoted 7 lines · Arnd Bergmann

In commit "usb: phy: add USB_SUPPORT dependency", I tried to fix the dependency for this driver, but unfortunately I missed that we need both USB_COMMON and USB_SUPPORT here, and we can still get the same link error in the much rarer case that USB_COMMON is a loadable module and the phy driver is build-in:

Quoted 6 lines

drivers/phy/phy-sun4i-usb.o: In function `sun4i_usb_phy_probe':
phy-sun4i-usb.c:(.text.sun4i_usb_phy_probe+0x1a6): undefined reference to `of_usb_get_dr_mode_by_phy'

This adds the select, hopefully fixing it properly this time.

Thanks for catching this:

Quoted 3 lines

---
I see the original patch hasn't made it into linux-next yet, so ideally just fold this patch into the first one.

The original patch is in 4.8-rc# (it got there after rc1).

Regards,

Hans

Quoted 16 lines

Sorry for not getting it right the first time around.

drivers/phy/Kconfig +1 -0
index 985dff8558e5..c717f306d131 100644
@@ -262,6 +262,7 @@ config PHY_SUN4I_USB
 	depends on POWER_SUPPLY
 	depends on USB_SUPPORT
 	select GENERIC_PHY
+	select USB_COMMON
 	help
 	  Enable this to support the transceiver that is part of Allwinner
 	  sunxi SoCs.
#5 lore raw

Re: [PATCH] phy-sun4i-usb: select 'USB_COMMON'

Quoted 5 lines · CEST Hans de Goede
Quoted 3 lines

---
I see the original patch hasn't made it into linux-next yet, so ideally just fold this patch into the first one.

The original patch is in 4.8-rc# (it got there after rc1).

To clarify: I didn't mean it should be folded into the patch that introduced the symbol, but instead should be folded into my first attempt at fixing it.

Arnd

#6 lore raw
In reply to Kishon Vijay Abraham I
Quoted 18 lines · CEST Kishon Vijay Abraham I
Quoted 16 lines · Hans de Goede

Hi,

Quoted 13 lines · Arnd Bergmann

The driver now calls of_usb_get_dr_mode_by_phy, which is part of the USB core layer, and it fails to build when that is not provided:

drivers/phy/phy-sun4i-usb.o: In function `sun4i_usb_phy_probe':
phy-sun4i-usb.c:(.text.sun4i_usb_phy_probe+0x140): undefined reference to `of_usb_get_dr_mode_by_phy'

We already have a couple of other PHY drivers with a dependency on USB_SUPPORT, so that seems to be the easiest fix here.

An alternative would be to adjust the #ifdef in include/linux/usb/of.h to also check for CONFIG_USB_SUPPORT.

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
Fixes b33ecca87df9 ("phy-sun4i-usb: Add support for peripheral-only mode")

Good catch, patch LGTM:

merged, thanks.

There is one more that came up today, with the meson usb2 phy driver.

I've now implemented the "alternative" I mentioned above, which should avoid introducing other instances of this bug in the future.

Sorry for all the back-and-forth here,

Arnd