Re: [PATCH] net: can: fix build dependency

From: Arnd Bergmann
Date: Wed Dec 10 2025 - 09:04:56 EST


On Wed, Dec 10, 2025, at 10:38, Marc Kleine-Budde wrote:
> On 10.12.2025 10:10:27, Arnd Bergmann wrote:
>> On Wed, Dec 10, 2025, at 09:16, Marc Kleine-Budde wrote:
>>
>> Sorry I forgot to reply here: the '&& CAN' is absolutely
>> required here, otherwise you can configure CAN device drivers
>> as built-in with CAN_DEV=y CAN=m, and that results in a
>> link failure.
>
> You mean:
>
> | $ grep ^CONFIG_CAN .config
> | CONFIG_CAN=m
> | CONFIG_CAN_RAW=m
> | CONFIG_CAN_BCM=m
> | CONFIG_CAN_GW=m
> | CONFIG_CAN_DEV=y
> | CONFIG_CAN_VXCAN=y
> | CONFIG_CAN_NETLINK=y
> | CONFIG_CAN_CALC_BITTIMING=y
> | CONFIG_CAN_RX_OFFLOAD=y
> | CONFIG_CAN_DUMMY=y
> | CONFIG_CAN_GS_USB=y

Yes, I'm pretty sure I saw link failures with configurations
like this one.

> ...which works for me.

Looking at a random exported symbol from can_dev.ko, I see

obj-$(CONFIG_CAN) += can-dev.o
drivers/net/can/dev/dev.c:EXPORT_SYMBOL(can_hwtstamp_get);
drivers/net/can/usb/gs_usb.c: return can_hwtstamp_get(netdev, cfg);

so in the configuration you list above, can-dev.ko is a
loadable module that exports can_hwtstamp_get, while gs_usb.o
is built-in and unable to link to that symbol.

Arnd