|
20 | 20 | */ |
21 | 21 |
|
22 | 22 | #define INCLUDE_VERMAGIC |
23 | | -#include <asm/atomic.h> |
24 | | -#include <asm/uaccess.h> |
25 | 23 | #include <linux/build-salt.h> |
26 | 24 | #include <linux/cdev.h> |
27 | 25 | #include <linux/compiler.h> |
28 | 26 | #include <linux/cred.h> /* current_uid(), current_euid() */ |
29 | | -#include <linux/elfnote-lto.h> |
30 | 27 | #include <linux/errno.h> /* error codes */ |
31 | | -#include <linux/export-internal.h> |
32 | 28 | #include <linux/fcntl.h> |
33 | 29 | #include <linux/fs.h> |
34 | 30 | #include <linux/init.h> |
|
48 | 44 | #include <linux/uaccess.h> /* copy_*_user */ |
49 | 45 | #include <linux/vermagic.h> |
50 | 46 | #include <linux/version.h> |
| 47 | +/* As a Linux kernel bug tested on Linux v5.9.2 these includes must come after some other includes |
| 48 | + * otherwise the build fails with: error: unknown type name ‘mm_segment_t’; |
| 49 | + * Their origin from LDD3 give a clue as to what may need to come before: |
| 50 | + * https://github.com/martinezjavier/ldd3/blob/d0c90d4d872b8591563d5a4ba7b3f522c5072551/scull/pipe.c#L29 |
| 51 | + * https://github.com/martinezjavier/ldd3/blob/d0c90d4d872b8591563d5a4ba7b3f522c5072551/scull/access.c#L29 |
| 52 | + * This bug had been fixed somewhere by linux v6.8.12. |
| 53 | + */ |
| 54 | +#include <asm/uaccess.h> |
| 55 | +#include <linux/atomic.h> |
51 | 56 |
|
52 | 57 | /* Liner kernel version dependant stuff. */ |
53 | 58 |
|
@@ -265,7 +270,7 @@ static int scull_s_open(struct inode *inode, struct file *filp) |
265 | 270 | { |
266 | 271 | struct scull_dev *dev = &scull_s_device; /* device information */ |
267 | 272 |
|
268 | | - if (! atomic_dec_and_test (&scull_s_available)) { |
| 273 | + if (!atomic_dec_and_test(&scull_s_available)) { |
269 | 274 | atomic_inc(&scull_s_available); |
270 | 275 | return -EBUSY; /* already open */ |
271 | 276 | } |
@@ -1610,8 +1615,8 @@ void scull_p_cleanup(void) |
1610 | 1615 | } |
1611 | 1616 |
|
1612 | 1617 | BUILD_SALT; |
1613 | | -BUILD_LTO_INFO; |
1614 | 1618 | MODULE_INFO(vermagic, VERMAGIC_STRING); |
| 1619 | + |
1615 | 1620 | MODULE_INFO(name, KBUILD_MODNAME); |
1616 | 1621 | MODULE_AUTHOR("Alessandro Rubini, Jonathan Corbet"); |
1617 | 1622 | MODULE_LICENSE("Dual BSD/GPL"); |
0 commit comments