Skip to content

Commit 68c1e5e

Browse files
committed
added include for generated/uapi/linux/version.h, linux/version.h is not part of linux-headers at some distributions
Signed-off-by: Don Rudo <[email protected]>
1 parent 47ca707 commit 68c1e5e

File tree

4 files changed

+25
-14
lines changed

4 files changed

+25
-14
lines changed

drivers/hwmon/nzxt-grid3.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@
3333
* Copyright 2019-2021 Jonas Malaco <[email protected]>
3434
*/
3535

36-
#if KERNEL_VERSION(6, 12, 0) > LINUX_VERSION_CODE
37-
#include <linux/unaligned.h>
38-
#else
36+
#include <generated/uapi/linux/version.h>
37+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
38+
// kernel before 6.12:
3939
#include <asm/unaligned.h>
40+
#else
41+
// kernel 6.12 onwards:
42+
#include <linux/unaligned.h>
4043
#endif
4144

4245
#include <linux/bitops.h>

drivers/hwmon/nzxt-kraken2.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99
* Copyright 2019-2021 Jonas Malaco <[email protected]>
1010
*/
1111

12-
#if KERNEL_VERSION(6, 12, 0) > LINUX_VERSION_CODE
13-
#include <linux/unaligned.h>
14-
#else
12+
#include <generated/uapi/linux/version.h>
13+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
14+
// kernel before 6.12:
1515
#include <asm/unaligned.h>
16+
#else
17+
// kernel 6.12 onwards:
18+
#include <linux/unaligned.h>
1619
#endif
1720

1821
#include <linux/hid.h>

drivers/hwmon/nzxt-kraken3.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* Copyright 2022 Aleksa Savic <[email protected]>
99
*/
1010

11+
#include <generated/uapi/linux/version.h>
12+
1113
#include <linux/debugfs.h>
1214
#include <linux/hid.h>
1315
#include <linux/hwmon.h>
@@ -18,10 +20,12 @@
1820
#include <linux/spinlock.h>
1921
#include <linux/wait.h>
2022

21-
#if KERNEL_VERSION(6, 12, 0) > LINUX_VERSION_CODE
22-
#include <linux/unaligned.h>
23-
#else
23+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
24+
// kernel before 6.12:
2425
#include <asm/unaligned.h>
26+
#else
27+
// kernel 6.12 onwards:
28+
#include <linux/unaligned.h>
2529
#endif
2630

2731
#define USB_VENDOR_ID_NZXT 0x1e71

drivers/hwmon/nzxt-smart2.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (c) 2021 Aleksandr Mezin
66
*/
77

8-
#include <linux/version.h>
8+
#include <generated/uapi/linux/version.h>
99

1010
#include <linux/hid.h>
1111
#include <linux/hwmon.h>
@@ -20,11 +20,12 @@
2020
#include <linux/wait.h>
2121

2222
#include <asm/byteorder.h>
23-
24-
#if KERNEL_VERSION(6, 12, 0) > LINUX_VERSION_CODE
25-
#include <linux/unaligned.h>
26-
#else
23+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
24+
// kernel before 6.12:
2725
#include <asm/unaligned.h>
26+
#else
27+
// kernel 6.12 onwards:
28+
#include <linux/unaligned.h>
2829
#endif
2930

3031
/*

0 commit comments

Comments
 (0)