From 5f8983f2ec77ff0333d111bc23d454afc0de4176 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Mon, 17 Oct 2022 12:56:59 +0200 Subject: [PATCH] drivers: can: npl: ensure CANFD_FDF flag is defined Linux kernels before v5.14 do not define the CANFD_FDF flag. The flag is disregarded within the Linux kernel. It is just there for being able to reuse the canfd_frame struct for classic CAN frames in Linux user-space applications. Define the CANFD_FDF flag locally if not already defined to allow compiling against older Linux kernel headers. See the following Linux kernel commit for further details: 02546884221279da2725e87e35348290470363d7 Signed-off-by: Henrik Brix Andersen --- drivers/can/can_native_posix_linux_socketcan.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/can/can_native_posix_linux_socketcan.c b/drivers/can/can_native_posix_linux_socketcan.c index 4747031195f..56295a8f843 100644 --- a/drivers/can/can_native_posix_linux_socketcan.c +++ b/drivers/can/can_native_posix_linux_socketcan.c @@ -35,6 +35,11 @@ #include "can_native_posix_linux_socketcan.h" +#ifndef CANFD_FDF +/* Linux kernels before v5.14 do not define CANFD_FDF */ +#define CANFD_FDF 0x04 +#endif /* CANFD_FDF */ + int linux_socketcan_iface_open(const char *if_name) { struct sockaddr_can addr;