[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251127-inquisitive-vegan-boobook-abac0e-mkl@pengutronix.de>
Date: Thu, 27 Nov 2025 23:22:15 +0100
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Oliver Hartkopp <socketcan@...tkopp.net>
Cc: linux-can@...r.kernel.org, netdev@...r.kernel.org, davem@...emloft.net,
kuba@...nel.org, kernel@...gutronix.de, Vincent Mailhol <mailhol@...nel.org>
Subject: Re: [net-next] can: raw: fix build without CONFIG_CAN_DEV
On 27.11.2025 22:07:10, Oliver Hartkopp wrote:
> The feature to instantly reject unsupported CAN frames makes use of CAN
> netdevice specific flags which are only accessible when the CAN device
> driver infrastructure is built.
>
> Therefore check for CONFIG_CAN_DEV and fall back to MTU testing when the
> CAN device driver infrastructure is absent.
>
> Fixes: 1a620a723853 ("can: raw: instantly reject unsupported CAN frames")
> Reported-by: Vincent Mailhol <mailhol@...nel.org>
> Signed-off-by: Oliver Hartkopp <socketcan@...tkopp.net>
That's not sufficient. We can build the CAN_DEV as a module but compile
CAN_RAW into the kernel.
This patch does the same as your's but only with a single ifdef in the
header file.
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 52c8be5c160e..14d58461430e 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -111,7 +111,14 @@ struct net_device *alloc_candev_mqs(int sizeof_priv, unsigned int echo_skb_max,
void free_candev(struct net_device *dev);
/* a candev safe wrapper around netdev_priv */
+#ifdef CONFIG_CAN_DEV
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
int open_candev(struct net_device *dev);
void close_candev(struct net_device *dev);
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 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists