Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

can: fix build dependency

A recent bugfix introduced a new problem with Kconfig dependencies:

WARNING: unmet direct dependencies detected for CAN_DEV
Depends on [n]: NETDEVICES [=n] && CAN [=m]
Selected by [m]:
- CAN [=m] && NET [=y]

Since the CAN core code now links into the CAN device code, that
particular function needs to be available, though the rest of it
does not.

Revert the incomplete fix and instead use Makefile logic to avoid
the link failure.

Fixes: cb2dc6d2869a ("can: Kconfig: select CAN driver infrastructure by default")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512091523.zty3CLmc-lkp@intel.com/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Oliver Hartkopp <socketcan@hartkopp.net>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://patch.msgid.link/20251204100015.1033688-1-arnd@kernel.org
[mkl: removed module option from CAN_DEV help text (thanks Vincent)]
[mkl: removed '&& CAN' from Kconfig dependency (thanks Vincent)]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

authored by

Arnd Bergmann and committed by
Marc Kleine-Budde
6abd4577 186468c6

+4 -9
+1 -4
drivers/net/can/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 3 3 menuconfig CAN_DEV 4 - tristate "CAN Device Drivers" 4 + bool "CAN Device Drivers" 5 5 default y 6 6 depends on CAN 7 7 help ··· 16 16 This section contains all the CAN(-FD) device drivers including the 17 17 virtual ones. If you own such devices or plan to use the virtual CAN 18 18 interfaces to develop applications, say Y here. 19 - 20 - To compile as a module, choose M here: the module will be called 21 - can-dev. 22 19 23 20 if CAN_DEV 24 21
+1 -1
drivers/net/can/Makefile
··· 7 7 obj-$(CONFIG_CAN_VXCAN) += vxcan.o 8 8 obj-$(CONFIG_CAN_SLCAN) += slcan/ 9 9 10 - obj-y += dev/ 10 + obj-$(CONFIG_CAN_DEV) += dev/ 11 11 obj-y += esd/ 12 12 obj-y += rcar/ 13 13 obj-y += rockchip/
+2 -3
drivers/net/can/dev/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 3 - obj-$(CONFIG_CAN_DEV) += can-dev.o 3 + obj-$(CONFIG_CAN) += can-dev.o 4 4 5 - can-dev-y += skb.o 6 - 5 + can-dev-$(CONFIG_CAN_DEV) += skb.o 7 6 can-dev-$(CONFIG_CAN_CALC_BITTIMING) += calc_bittiming.o 8 7 can-dev-$(CONFIG_CAN_NETLINK) += bittiming.o 9 8 can-dev-$(CONFIG_CAN_NETLINK) += dev.o
-1
net/can/Kconfig
··· 5 5 6 6 menuconfig CAN 7 7 tristate "CAN bus subsystem support" 8 - select CAN_DEV 9 8 help 10 9 Controller Area Network (CAN) is a slow (up to 1Mbit/s) serial 11 10 communications protocol. Development of the CAN bus started in