On 20/05/2020 12:08, Bryan O'Donoghue wrote:
On 20/05/2020 11:35, Heikki Krogerus wrote:
On Wed, May 20, 2020 at 11:05:26AM +0100, Bryan O'Donoghue wrote:
When I switched on USB role switching for the tps6598x I completely
forgot
to add the Kconfig dependency.
This patch ensures the dependency is there to prevent compilation error
when role-switching is off.
There are stubs for the those functions, so there should not be any
compilation errors.
That's what I initially thought too, then I saw this.
git show da4b5d18dd949abdda7c8ea76c9483b5edd49616
but looking at role.h
#if IS_ENABLED(CONFIG_USB_ROLE_SWITCH)
int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role
role);
#else
static inline int usb_role_switch_set_role(struct usb_role_switch *sw,
enum usb_role role)
{
return 0;
}
#endif
That should work.
Hmm, let me see if I can figure this out...
Well if I do this
diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
index d53db520e209..636a5428b47e 100644
--- a/drivers/usb/chipidea/Kconfig
+++ b/drivers/usb/chipidea/Kconfig
@@ -6,7 +6,6 @@ config USB_CHIPIDEA
select EXTCON
select RESET_CONTROLLER
select USB_ULPI_BUS
- select USB_ROLE_SWITCH
my build does this
drivers/usb/dwc3/drd.o: In function `dwc3_usb_role_switch_get':
/home/deckard/Development/qualcomm/qlt-kernel/drivers/usb/dwc3/drd.c:508:
undefined reference to `usb_role_switch_get_drvdata'
drivers/usb/dwc3/drd.o: In function `dwc3_usb_role_switch_set':
/home/deckard/Development/qualcomm/qlt-kernel/drivers/usb/dwc3/drd.c:484:
undefined reference to `usb_role_switch_get_drvdata'
drivers/usb/dwc3/drd.o: In function `dwc3_setup_role_switch':
/home/deckard/Development/qualcomm/qlt-kernel/drivers/usb/dwc3/drd.c:555:
undefined reference to `usb_role_switch_register'
drivers/usb/dwc3/drd.o: In function `dwc3_drd_exit':
/home/deckard/Development/qualcomm/qlt-kernel/drivers/usb/dwc3/drd.c:628:
undefined reference to `usb_role_switch_unregister'
drivers/usb/chipidea/core.o: In function `ci_usb_role_switch_get':
/home/deckard/Development/qualcomm/qlt-kernel/drivers/usb/chipidea/core.c:621:
undefined reference to `usb_role_switch_get_drvdata'
drivers/usb/chipidea/core.o: In function `ci_usb_role_switch_set':
/home/deckard/Development/qualcomm/qlt-kernel/drivers/usb/chipidea/core.c:635:
undefined reference to `usb_role_switch_get_drvdata'
drivers/usb/chipidea/core.o: In function `ci_hdrc_remove':
/home/deckard/Development/qualcomm/qlt-kernel/drivers/usb/chipidea/core.c:1231:
undefined reference to `usb_role_switch_unregister'
drivers/usb/chipidea/core.o: In function `ci_hdrc_probe':
/home/deckard/Development/qualcomm/qlt-kernel/drivers/usb/chipidea/core.c:1210:
undefined reference to `usb_role_switch_unregister'
/home/deckard/Development/qualcomm/qlt-kernel/drivers/usb/chipidea/core.c:1143:
undefined reference to `usb_role_switch_register'
drivers/usb/typec/tps6598x.o: In function `tps6598x_set_data_role':
/home/deckard/Development/qualcomm/qlt-kernel/drivers/usb/typec/tps6598x.c:208:
undefined reference to `usb_role_switch_set_role'
drivers/usb/typec/tps6598x.o: In function `tps6598x_remove':
/home/deckard/Development/qualcomm/qlt-kernel/drivers/usb/typec/tps6598x.c:603:
undefined reference to `usb_role_switch_put'
drivers/usb/typec/tps6598x.o: In function `tps6598x_set_data_role':
/home/deckard/Development/qualcomm/qlt-kernel/drivers/usb/typec/tps6598x.c:208:
undefined reference to `usb_role_switch_set_role'
drivers/usb/typec/tps6598x.o: In function `tps6598x_probe':
/home/deckard/Development/qualcomm/qlt-kernel/drivers/usb/typec/tps6598x.c:520:
undefined reference to `fwnode_usb_role_switch_get'
/home/deckard/Development/qualcomm/qlt-kernel/drivers/usb/typec/tps6598x.c:590:
undefined reference to `usb_role_switch_put'
drivers/usb/typec/tps6598x.o: In function `tps6598x_set_data_role':
/home/deckard/Development/qualcomm/qlt-kernel/drivers/usb/typec/tps6598x.c:208:
undefined reference to `usb_role_switch_set_role'
make[1]: ***
[/home/deckard/Development/qualcomm/qlt-kernel/Makefile:1106: vmlinux]
Error 1
so its consistent anyway