[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d9431d8c-5050-4b38-a61c-cba980255c4b@kernel.org>
Date: Sat, 29 Nov 2025 12:09:49 +0100
From: Vincent Mailhol <mailhol@...nel.org>
To: Oliver Hartkopp <socketcan@...tkopp.net>, linux-can@...r.kernel.org
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
kernel@...gutronix.de, mkl@...gutronix.de, kernel test robot <lkp@...el.com>
Subject: Re: [can-next v3] can: Kconfig: select CAN driver infrastructure by
default
Hi Oliver,
On 29/11/2025 at 10:05, Oliver Hartkopp wrote:
> The CAN bus support enabled with CONFIG_CAN provides a socket-based
> access to CAN interfaces. With the introduction of the latest CAN protocol
> CAN XL additional configuration status information needs to be exposed to
> the network layer than formerly provided by standard Linux network drivers.
>
> This requires the CAN driver infrastructure to be selected by default.
> As the CAN network layer can only operate on CAN interfaces anyway all
> distributions and common default configs enable at least one CAN driver.
>
> So selecting CONFIG_CAN_DEV when CONFIG_CAN is selected by the user has
> no effect on established configurations but solves potential build issues
> when CONFIG_CAN[_XXX]=y is set together with CANFIG_CAN_DEV=m
>
> Fixes: 1a620a723853 ("can: raw: instantly reject unsupported CAN frames")
> Reported-by: Vincent Mailhol <mailhol@...nel.org>
> Reported-by: kernel test robot <lkp@...el.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202511282325.uVQFRTkA-lkp@intel.com/
> Suggested-by: Marc Kleine-Budde <mkl@...gutronix.de>
> Signed-off-by: Oliver Hartkopp <socketcan@...tkopp.net>
> ---
>
> v2: In fact CONFIG_CAN_NETLINK was missing too. Reported by kernel test robot.
> v3: With the change in dev.h the compilation of the of the netlink code can be
> avoided when only virtual CAN interfaces (vcan, vxcan) are required.
>
> ---
>
> include/linux/can/dev.h | 7 +++++++
> net/can/Kconfig | 1 +
> 2 files changed, 8 insertions(+)
>
> diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
> index 13b25b0dceeb..2514a5c942e5 100644
> --- a/include/linux/can/dev.h
> +++ b/include/linux/can/dev.h
> @@ -109,11 +109,18 @@ struct net_device *alloc_candev_mqs(int sizeof_priv, unsigned int echo_skb_max,
> #define alloc_candev_mq(sizeof_priv, echo_skb_max, count) \
> alloc_candev_mqs(sizeof_priv, echo_skb_max, count, count)
> void free_candev(struct net_device *dev);
>
> /* a candev safe wrapper around netdev_priv */
> +#if IS_ENABLED(CONFIG_CAN_NETLINK)
> struct can_priv *safe_candev_priv(struct net_device *dev);
> +#else
> +static inline struct can_priv *safe_candev_priv(struct net_device *dev)
> +{
> + return NULL;
> +}
> +#endif
As far as I can see, safe_candev_priv() is only used in raw.c. I think it would
be cleaner to just move it there and turn it into a static function.
> int open_candev(struct net_device *dev);
> void close_candev(struct net_device *dev);
> void can_set_default_mtu(struct net_device *dev);
> int __must_check can_set_static_ctrlmode(struct net_device *dev,
> diff --git a/net/can/Kconfig b/net/can/Kconfig
> index af64a6f76458..e4ccf731a24c 100644
> --- a/net/can/Kconfig
> +++ b/net/can/Kconfig
> @@ -3,10 +3,11 @@
> # Controller Area Network (CAN) network layer core configuration
> #
>
> 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
> 1983 at Robert Bosch GmbH, and the protocol was officially
> released in 1986. The CAN bus was originally mainly for automotive,
Yours sincerely,
Vincent Mailhol
Powered by blists - more mailing lists