can: fix build dependency
authorArnd Bergmann <arnd@arndb.de>
Thu, 4 Dec 2025 10:00:09 +0000 (11:00 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 10 Dec 2025 08:19:34 +0000 (09:19 +0100)
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>
drivers/net/can/Kconfig
drivers/net/can/Makefile
drivers/net/can/dev/Makefile
net/can/Kconfig

index e15e320..460a74a 100644 (file)
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
 menuconfig CAN_DEV
-       tristate "CAN Device Drivers"
+       bool "CAN Device Drivers"
        default y
        depends on CAN
        help
@@ -17,9 +17,6 @@ menuconfig CAN_DEV
          virtual ones. If you own such devices or plan to use the virtual CAN
          interfaces to develop applications, say Y here.
 
-         To compile as a module, choose M here: the module will be called
-         can-dev.
-
 if CAN_DEV
 
 config CAN_VCAN
index d7bc10a..37e2f1a 100644 (file)
@@ -7,7 +7,7 @@ obj-$(CONFIG_CAN_VCAN)          += vcan.o
 obj-$(CONFIG_CAN_VXCAN)                += vxcan.o
 obj-$(CONFIG_CAN_SLCAN)                += slcan/
 
-obj-y                          += dev/
+obj-$(CONFIG_CAN_DEV)          += dev/
 obj-y                          += esd/
 obj-y                          += rcar/
 obj-y                          += rockchip/
index 633687d..64226ac 100644 (file)
@@ -1,9 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 
-obj-$(CONFIG_CAN_DEV) += can-dev.o
-
-can-dev-y += skb.o
+obj-$(CONFIG_CAN) += can-dev.o
 
+can-dev-$(CONFIG_CAN_DEV) += skb.o
 can-dev-$(CONFIG_CAN_CALC_BITTIMING) += calc_bittiming.o
 can-dev-$(CONFIG_CAN_NETLINK) += bittiming.o
 can-dev-$(CONFIG_CAN_NETLINK) += dev.o
index e4ccf73..af64a6f 100644 (file)
@@ -5,7 +5,6 @@
 
 menuconfig CAN
        tristate "CAN bus subsystem support"
-       select CAN_DEV
        help
          Controller Area Network (CAN) is a slow (up to 1Mbit/s) serial
          communications protocol. Development of the CAN bus started in