Thread (6 messages) 6 messages, 2 authors, 2025-11-27

Re: [net-next] can: raw: fix build without CONFIG_CAN_DEV

From: Oliver Hartkopp <socketcan@hartkopp.net>
Date: 2025-11-27 23:25:28
Also in: linux-can

Answering myself:

You were right (raw.c built-in, drivers as modules):

ld: net/can/raw.o: in function `raw_check_txframe':
/home/hartko/linux/net/can/raw.c:933:(.text+0xb2c): undefined reference 
to `safe_candev_priv'
make[2]: *** [scripts/Makefile.vmlinux:72: vmlinux.unstripped] Error 1
make[1]: *** [/home/hartko/linux/Makefile:1242: vmlinux] Error 2
make: *** [Makefile:248: __sub-make] Error 2

Maybe its a better task for tomorrow ...

Sorry for the noise.

Best regards,
Oliver

On 28.11.25 00:03, Oliver Hartkopp wrote:
Hello Marc,

On 27.11.25 23:43, Marc Kleine-Budde wrote:
quoted
On 27.11.2025 23:35:48, Oliver Hartkopp wrote:
quoted
quoted
That's not sufficient. We can build the CAN_DEV as a module but compile
CAN_RAW into the kernel.
quoted
Oh, yes that's better.
It's nicer, but it will not work if you build CAN_RAW into the kernel
and CAN_DEV as a module....Let me think of the right kconfig magic to
workaround this...
No need for it IMO.

I built my kernel with the CAN netlayer stuff into the kernel and 
disabled the CAN_DEV stuff.

As you defined

static inline struct can_priv *safe_candev_priv(struct net_device *dev) {
     return NULL;
}

in

include/linux/can/dev.h

this function is now inside raw.c which compiles excellent.

Building without CONFIG_CAN_DEV is not a valid use-case anyway.

It would only make sense, if someone wants to create an out-of-tree CAN 
driver without netlink ...

Best regards,
Oliver
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help