* [PATCH] net: can: fix build dependency
@ 2025-12-04 10:00 Arnd Bergmann
2025-12-04 18:03 ` Oliver Hartkopp
2025-12-04 23:30 ` Vincent Mailhol
0 siblings, 2 replies; 7+ messages in thread
From: Arnd Bergmann @ 2025-12-04 10:00 UTC (permalink / raw)
To: Marc Kleine-Budde, Vincent Mailhol, Oliver Hartkopp
Cc: Arnd Bergmann, Jimmy Assarsson, linux-can, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/can/Kconfig | 4 ++--
drivers/net/can/Makefile | 2 +-
drivers/net/can/dev/Makefile | 5 ++---
net/can/Kconfig | 1 -
4 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
index e15e320db476..bc074218d0ee 100644
--- a/drivers/net/can/Kconfig
+++ b/drivers/net/can/Kconfig
@@ -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
@@ -20,7 +20,7 @@ menuconfig CAN_DEV
To compile as a module, choose M here: the module will be called
can-dev.
-if CAN_DEV
+if CAN_DEV && CAN
config CAN_VCAN
tristate "Virtual Local CAN Interface (vcan)"
diff --git a/drivers/net/can/Makefile b/drivers/net/can/Makefile
index d7bc10a6b8ea..37e2f1a2faec 100644
--- a/drivers/net/can/Makefile
+++ b/drivers/net/can/Makefile
@@ -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/
diff --git a/drivers/net/can/dev/Makefile b/drivers/net/can/dev/Makefile
index 633687d6b6c0..64226acf0f3d 100644
--- a/drivers/net/can/dev/Makefile
+++ b/drivers/net/can/dev/Makefile
@@ -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
diff --git a/net/can/Kconfig b/net/can/Kconfig
index e4ccf731a24c..af64a6f76458 100644
--- a/net/can/Kconfig
+++ b/net/can/Kconfig
@@ -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
--
2.39.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] net: can: fix build dependency
2025-12-04 10:00 [PATCH] net: can: fix build dependency Arnd Bergmann
@ 2025-12-04 18:03 ` Oliver Hartkopp
2025-12-04 23:30 ` Vincent Mailhol
1 sibling, 0 replies; 7+ messages in thread
From: Oliver Hartkopp @ 2025-12-04 18:03 UTC (permalink / raw)
To: Arnd Bergmann, Marc Kleine-Budde, Vincent Mailhol
Cc: Arnd Bergmann, Jimmy Assarsson, linux-can, linux-kernel
Hello Arnd,
On 04.12.25 11:00, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Oliver Hartkopp <socketcan@hartkopp.net>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
I'm still not sure what this patch really does but it works excellent
and fits exactly what is intended! ;-)
Many thanks,
Oliver
> ---
> drivers/net/can/Kconfig | 4 ++--
> drivers/net/can/Makefile | 2 +-
> drivers/net/can/dev/Makefile | 5 ++---
> net/can/Kconfig | 1 -
> 4 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
> index e15e320db476..bc074218d0ee 100644
> --- a/drivers/net/can/Kconfig
> +++ b/drivers/net/can/Kconfig
> @@ -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
> @@ -20,7 +20,7 @@ menuconfig CAN_DEV
> To compile as a module, choose M here: the module will be called
> can-dev.
>
> -if CAN_DEV
> +if CAN_DEV && CAN
>
> config CAN_VCAN
> tristate "Virtual Local CAN Interface (vcan)"
> diff --git a/drivers/net/can/Makefile b/drivers/net/can/Makefile
> index d7bc10a6b8ea..37e2f1a2faec 100644
> --- a/drivers/net/can/Makefile
> +++ b/drivers/net/can/Makefile
> @@ -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/
> diff --git a/drivers/net/can/dev/Makefile b/drivers/net/can/dev/Makefile
> index 633687d6b6c0..64226acf0f3d 100644
> --- a/drivers/net/can/dev/Makefile
> +++ b/drivers/net/can/dev/Makefile
> @@ -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
> diff --git a/net/can/Kconfig b/net/can/Kconfig
> index e4ccf731a24c..af64a6f76458 100644
> --- a/net/can/Kconfig
> +++ b/net/can/Kconfig
> @@ -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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] net: can: fix build dependency
2025-12-04 10:00 [PATCH] net: can: fix build dependency Arnd Bergmann
2025-12-04 18:03 ` Oliver Hartkopp
@ 2025-12-04 23:30 ` Vincent Mailhol
2025-12-10 8:16 ` Marc Kleine-Budde
1 sibling, 1 reply; 7+ messages in thread
From: Vincent Mailhol @ 2025-12-04 23:30 UTC (permalink / raw)
To: Arnd Bergmann, Marc Kleine-Budde, Oliver Hartkopp
Cc: Arnd Bergmann, Jimmy Assarsson, linux-can, linux-kernel
Hi Arnd,
Thanks for the fix!
On 04/12/2025 at 11:00, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/net/can/Kconfig | 4 ++--
> drivers/net/can/Makefile | 2 +-
> drivers/net/can/dev/Makefile | 5 ++---
> net/can/Kconfig | 1 -
> 4 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
> index e15e320db476..bc074218d0ee 100644
> --- a/drivers/net/can/Kconfig
> +++ b/drivers/net/can/Kconfig
> @@ -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
> @@ -20,7 +20,7 @@ menuconfig CAN_DEV
> To compile as a module, choose M here: the module will be called
^^^^^^^^
After this change, it is not possible to "choose M" for CAN_DEV anymore. I would
suggest to modify (or remove) the above sentence.
> can-dev.> -if CAN_DEV
> +if CAN_DEV && CAN
^^^^^^
Is this needed? CAN_DEV depends on CAN, so the condition
CAN_DEV && !CAN
should not be reachable.
> config CAN_VCAN
> tristate "Virtual Local CAN Interface (vcan)"
> diff --git a/drivers/net/can/Makefile b/drivers/net/can/Makefile
> index d7bc10a6b8ea..37e2f1a2faec 100644
> --- a/drivers/net/can/Makefile
> +++ b/drivers/net/can/Makefile
> @@ -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/
> diff --git a/drivers/net/can/dev/Makefile b/drivers/net/can/dev/Makefile
> index 633687d6b6c0..64226acf0f3d 100644
> --- a/drivers/net/can/dev/Makefile
> +++ b/drivers/net/can/dev/Makefile
> @@ -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
> diff --git a/net/can/Kconfig b/net/can/Kconfig
> index e4ccf731a24c..af64a6f76458 100644
> --- a/net/can/Kconfig
> +++ b/net/can/Kconfig
> @@ -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
Yours sincerely,
Vincent Mailhol
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] net: can: fix build dependency
2025-12-04 23:30 ` Vincent Mailhol
@ 2025-12-10 8:16 ` Marc Kleine-Budde
2025-12-10 9:10 ` Arnd Bergmann
0 siblings, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2025-12-10 8:16 UTC (permalink / raw)
To: Vincent Mailhol
Cc: Arnd Bergmann, Oliver Hartkopp, Arnd Bergmann, Jimmy Assarsson,
linux-can, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1330 bytes --]
On 05.12.2025 00:30:14, Vincent Mailhol wrote:
> > diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
> > index e15e320db476..bc074218d0ee 100644
> > --- a/drivers/net/can/Kconfig
> > +++ b/drivers/net/can/Kconfig
> > @@ -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
> > @@ -20,7 +20,7 @@ menuconfig CAN_DEV
> > To compile as a module, choose M here: the module will be called
> ^^^^^^^^
> After this change, it is not possible to "choose M" for CAN_DEV anymore. I would
> suggest to modify (or remove) the above sentence.
Removed the sentence why applying the patch.
>
> > can-dev.> -if CAN_DEV
> > +if CAN_DEV && CAN
> ^^^^^^
> Is this needed? CAN_DEV depends on CAN, so the condition
>
> CAN_DEV && !CAN
>
> should not be reachable.
Removed the '&& CAN' while applying the patch.
Thanks,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] net: can: fix build dependency
2025-12-10 8:16 ` Marc Kleine-Budde
@ 2025-12-10 9:10 ` Arnd Bergmann
2025-12-10 9:38 ` Marc Kleine-Budde
0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2025-12-10 9:10 UTC (permalink / raw)
To: Marc Kleine-Budde, Vincent Mailhol
Cc: Arnd Bergmann, Oliver Hartkopp, Jimmy Assarsson, linux-can,
linux-kernel
On Wed, Dec 10, 2025, at 09:16, Marc Kleine-Budde wrote:
> On 05.12.2025 00:30:14, Vincent Mailhol wrote:
>> > can-dev.> -if CAN_DEV
>> > +if CAN_DEV && CAN
>> ^^^^^^
>> Is this needed? CAN_DEV depends on CAN, so the condition
>>
>> CAN_DEV && !CAN
>>
>> should not be reachable.
>
> Removed the '&& CAN' while applying the patch.
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.
Arnd
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] net: can: fix build dependency
2025-12-10 9:10 ` Arnd Bergmann
@ 2025-12-10 9:38 ` Marc Kleine-Budde
2025-12-10 13:58 ` Arnd Bergmann
0 siblings, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2025-12-10 9:38 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Vincent Mailhol, Arnd Bergmann, Oliver Hartkopp, Jimmy Assarsson,
linux-can, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]
On 10.12.2025 10:10:27, Arnd Bergmann wrote:
> On Wed, Dec 10, 2025, at 09:16, Marc Kleine-Budde wrote:
> > On 05.12.2025 00:30:14, Vincent Mailhol wrote:
>
> >> > can-dev.> -if CAN_DEV
> >> > +if CAN_DEV && CAN
> >> ^^^^^^
> >> Is this needed? CAN_DEV depends on CAN, so the condition
> >>
> >> CAN_DEV && !CAN
> >>
> >> should not be reachable.
> >
> > Removed the '&& CAN' while applying the patch.
>
> 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
...which works for me.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] net: can: fix build dependency
2025-12-10 9:38 ` Marc Kleine-Budde
@ 2025-12-10 13:58 ` Arnd Bergmann
0 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2025-12-10 13:58 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: Vincent Mailhol, Arnd Bergmann, Oliver Hartkopp, Jimmy Assarsson,
linux-can, linux-kernel
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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-12-10 13:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-04 10:00 [PATCH] net: can: fix build dependency Arnd Bergmann
2025-12-04 18:03 ` Oliver Hartkopp
2025-12-04 23:30 ` Vincent Mailhol
2025-12-10 8:16 ` Marc Kleine-Budde
2025-12-10 9:10 ` Arnd Bergmann
2025-12-10 9:38 ` Marc Kleine-Budde
2025-12-10 13:58 ` Arnd Bergmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.