From 2f5cb7d22560f01acef2df59ea2b346fdb6740dd Mon Sep 17 00:00:00 2001
From: Charles Lane lane@duphy4.physics.drexel.edu
Date: Wed, 23 Dec 2020 12:02:24 -0500
Subject: [PATCH] Add #define fallthrough if missing in the kernel
include/linux/compiler_attributes.h (the fallthrough was added in kernel
5.4), needed to compile cleanly. Tested on Fedora31 (kernel 5.8.18, patch not
needed, but works) and Centos8 (kernel 4.18.0, patch needed, works).
From 2f5cb7d22560f01acef2df59ea2b346fdb6740dd Mon Sep 17 00:00:00 2001 From: Charles Lane lane@duphy4.physics.drexel.edu Date: Wed, 23 Dec 2020 12:02:24 -0500 Subject: [PATCH] Add #define fallthrough if missing in the kernel include/linux/compiler_attributes.h (the fallthrough was added in kernel 5.4), needed to compile cleanly. Tested on Fedora31 (kernel 5.8.18, patch not needed, but works) and Centos8 (kernel 4.18.0, patch needed, works).
usbtmc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/usbtmc.c b/usbtmc.c index 36d3e71..9b8dec6 100644 --- a/usbtmc.c +++ b/usbtmc.c @@ -24,6 +24,19 @@
include <linux/compat.h>
include "tmc.h"
+/* Linux kernel 5.4 has a definition of 'fallthrough', earlier kernels
+#if !defined(fallthrough) +#if __has_attribute(fallthrough) +# define fallthrough attribute((fallthrough)) +#else +# define fallthrough do {} while (0) / fallthrough / +#endif +#endif
/* Increment API VERSION when changing tmc.h with new flags or ioctls