Skip to contentSkip to conversation

thermal/thresholds: Fix uapi header macros leading to a compilation error

PATCH Applied Daniel Lezcano 2 participants 2 messages Dec 12, 2024 – Dec 16, 2024 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal/thresholds: Fix uapi header macros leading to a compilation error

The macros giving the direction of the crossing thresholds use the BIT macro which is not exported to the userspace. Consequently when an userspace program includes the header, it fails to compile.

Replace the macros by their litteral to allow the compilation of userspace program using this header.

---
 include/uapi/linux/thermal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/thermal.h +2 -2
index ba8604bdf206..349718c271eb 100644
@@ -3,8 +3,8 @@
 #define _UAPI_LINUX_THERMAL_H
 
 #define THERMAL_NAME_LENGTH	20
-#define THERMAL_THRESHOLD_WAY_UP	BIT(0)
-#define THERMAL_THRESHOLD_WAY_DOWN	BIT(1)
+#define THERMAL_THRESHOLD_WAY_UP	0x1
+#define THERMAL_THRESHOLD_WAY_DOWN	0x2
 
 enum thermal_device_mode {
 	THERMAL_DEVICE_DISABLED = 0,
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 19 lines · Daniel Lezcano

The macros giving the direction of the crossing thresholds use the BIT macro which is not exported to the userspace. Consequently when an userspace program includes the header, it fails to compile.

Replace the macros by their litteral to allow the compilation of userspace program using this header.

---
 include/uapi/linux/thermal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/thermal.h +0 -0
index ba8604bdf206..349718c271eb 100644
@@ -3,8 +3,8 @@
 #define _UAPI_LINUX_THERMAL_H

include/uapi/linux/thermal.h

Quoted 10 lines
include/uapi/linux/thermal.h +2 -3
 
 #define THERMAL_NAME_LENGTH    20
-#define THERMAL_THRESHOLD_WAY_UP       BIT(0)
-#define THERMAL_THRESHOLD_WAY_DOWN     BIT(1)
+#define THERMAL_THRESHOLD_WAY_UP       0x1
+#define THERMAL_THRESHOLD_WAY_DOWN     0x2
 
 enum thermal_device_mode {
        THERMAL_DEVICE_DISABLED = 0,
--

Applied as 6.13-rc material, thanks!