usb: usb_phy_gen: refine conditional declaration of usb_nop_xceiv_register
PATCH 1/1 usb: usb_phy_gen: refine conditional declaration of usb_nop_xceiv_register
Commit 3fa4d734 (usb: phy: rename nop_usb_xceiv => usb_phy_gen_xceiv) changed the conditional around the declaration of usb_nop_xceiv_register from
#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) to #if IS_ENABLED(CONFIG_NOP_USB_XCEIV)
While that looks the same, it is semantically different. The first expression is true if CONFIG_NOP_USB_XCEIV is built as module and if the including code is built as module. The second expression is true if code depending on CONFIG_NOP_USB_XCEIV if built as module or into the kernel.
As a result, the arm:allmodconfig build fails with
arch/arm/mach-omap2/built-in.o: In function `omap3_evm_init':arch/arm/mach-omap2/board-omap3evm.c:703: undefined reference to
`usb_nop_xceiv_register'
Fix the problem by reverting to the old conditional.
--- include/linux/usb/usb_phy_gen_xceiv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/usb/usb_phy_gen_xceiv.h +1 -1
@@ -12,7 +12,7 @@ struct usb_phy_gen_xceiv_platform_data { unsigned int needs_reset:1; }; -#if IS_ENABLED (CONFIG_NOP_USB_XCEIV ) +#if defined(CONFIG_NOP_USB_XCEIV ) || (defined(CONFIG_NOP_USB_XCEIV_MODULE ) && defined(MODULE ))/* sometimes transceivers are accessed only through e.g. ULPI */ extern void usb_nop_xceiv_register (void );extern void usb_nop_xceiv_unregister (void );
Signature · 1 line
1.7.9.7
Quoted 15 lines · Guenter Roeck
Commit
3fa4d734(usb: phy: renamenop_usb_xceiv=>usb_phy_gen_xceiv) changed the conditional around the declaration ofusb_nop_xceiv_registerfrom#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) to #if IS_ENABLED(CONFIG_NOP_USB_XCEIV)While that looks the same, it is semantically different. The first expression is true if
CONFIG_NOP_USB_XCEIVis built as module and if the including code is built as module. The second expression is true if code depending onCONFIG_NOP_USB_XCEIVif built as module or into the kernel.As a result, the arm:allmodconfig build fails with
Quoted 8 lines
arch/arm/mach-omap2/built-in.o: In function `omap3_evm_init':arch/arm/mach-omap2/board-omap3evm.c:703: undefined reference to
`usb_nop_xceiv_register'Fix the problem by reverting to the old conditional.
Cc Josh Boyer <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
I'm not entirely sure why I was CC'd on this one, but the patch looks good to me. I do wonder how many other uses of IS_ENABLED aren't taking this into account though.
josh
Quoted 20 lines
--- include/linux/usb/usb_phy_gen_xceiv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/usb/usb_phy_gen_xceiv.h +1
-1@@ -12,7 +12,7 @@ struct usb_phy_gen_xceiv_platform_data { unsigned int needs_reset:1; }; -#if IS_ENABLED (CONFIG_NOP_USB_XCEIV ) +#if defined(CONFIG_NOP_USB_XCEIV ) || (defined(CONFIG_NOP_USB_XCEIV_MODULE ) && defined(MODULE ))/* sometimes transceivers are accessed only through e.g. ULPI */ extern void usb_nop_xceiv_register (void );extern void usb_nop_xceiv_unregister (void );Signature · 1 line
1.7.9.7
Quoted 20 lines · Josh Boyer
Quoted 19 lines · Guenter Roeck
Commit
3fa4d734(usb: phy: renamenop_usb_xceiv=>usb_phy_gen_xceiv) changed the conditional around the declaration ofusb_nop_xceiv_registerfrom#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) to #if IS_ENABLED(CONFIG_NOP_USB_XCEIV)While that looks the same, it is semantically different. The first expression is true if
CONFIG_NOP_USB_XCEIVis built as module and if the including code is built as module. The second expression is true if code depending onCONFIG_NOP_USB_XCEIVif built as module or into the kernel.As a result, the arm:allmodconfig build fails with
arch/arm/mach-omap2/built-in.o: In function `omap3_evm_init':arch/arm/mach-omap2/board-omap3evm.c:703: undefined reference to
`usb_nop_xceiv_register'
Quoted 9 lines
Quoted 4 lines
Fix the problem by reverting to the old conditional.
Cc Josh Boyer <[email protected]>Signed-off-by Guenter Roeck <[email protected]>I'm not entirely sure why I was CC'd on this one, but the patch looks good to me. I do wonder how many other uses of
IS_ENABLEDaren't taking this into account though.
Unless I am wrong, you submitted a different patch to fix the same problem, which went nowhere, so I figured it was appropriate to Cc: you on this one. If not, my apologies.
As for other use cases of IS_ENABLED, agreed, that may be an ongoing concern. That will have to be addressed individually, though.
Thanks,
Guenter
Quoted 26 lines · Guenter Roeck
Quoted 25 lines · Josh Boyer
Quoted 23 lines · Guenter Roeck
Commit
3fa4d734(usb: phy: renamenop_usb_xceiv=>usb_phy_gen_xceiv) changed the conditional around the declaration ofusb_nop_xceiv_registerfrom#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) to #if IS_ENABLED(CONFIG_NOP_USB_XCEIV)While that looks the same, it is semantically different. The first expression is true if
CONFIG_NOP_USB_XCEIVis built as module and if the including code is built as module. The second expression is true if code depending onCONFIG_NOP_USB_XCEIVif built as module or into the kernel.As a result, the arm:allmodconfig build fails with
arch/arm/mach-omap2/built-in.o: In function `omap3_evm_init':arch/arm/mach-omap2/board-omap3evm.c:703: undefined reference to
`usb_nop_xceiv_register'Fix the problem by reverting to the old conditional.
Cc Josh Boyer <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Quoted 7 lines
Quoted 4 lines
I'm not entirely sure why I was CC'd on this one, but the patch looks good to me. I do wonder how many other uses of
IS_ENABLEDaren't taking this into account though.Unless I am wrong, you submitted a different patch to fix the same problem, which went nowhere, so I figured it was appropriate to Cc: you on this one. If not, my apologies.
Ah, so I did! Amazing what I can forget in a month.
Quoted 2 lines
As for other use cases of
IS_ENABLED, agreed, that may be an ongoing concern. That will have to be addressed individually, though.
Yep.
josh