Skip to contentSkip to conversation

ACPI: video: Add comment about acpi_video_backlight_use_native() usage

PATCH Applied Hans de Goede 2 participants 2 messages Oct 26, 2023 – Nov 20, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: video: Add comment about acpi_video_backlight_use_native() usage

Add a comment explaining that acpi_video_backlight_use_native() MUST only be used by GPU drivers and that it must NOT be used on other places.

---
The main reason for writing this patch is that some recent submitted patches actually were using acpi_video_backlight_use_native() wrong.

---
 include/acpi/video.h | 9 +++++++++
 1 file changed, 9 insertions(+)
include/acpi/video.h +9 -0
index 4230392b5b0b..3d538d4178ab 100644
@@ -75,6 +75,15 @@ static inline enum acpi_backlight_type acpi_video_get_backlight_type(void)
 	return __acpi_video_get_backlight_type(false, NULL);
 }
 
+/*
+ * This function MUST only be called by GPU drivers to check if the driver
+ * should register a backlight class device. This function not only checks
+ * if a GPU native backlight device should be registered it *also* tells
+ * the ACPI video-detect code that native GPU backlight control is available.
+ * Therefor calling this from any place other then the GPU driver is wrong!
+ * To check if GPU native backlight control is used in other places instead use:
+ *   if (acpi_video_get_backlight_type() == acpi_backlight_native) { ... }
+ */
 static inline bool acpi_video_backlight_use_native(void)
 {
 	return __acpi_video_get_backlight_type(true, NULL) == acpi_backlight_native;
Signature · 1 line
2.41.0
maintainer Applied
#1 lore raw
Quoted 23 lines · Hans de Goede

Add a comment explaining that acpi_video_backlight_use_native() MUST only be used by GPU drivers and that it must NOT be used on other places.

---
The main reason for writing this patch is that some recent submitted patches actually were using acpi_video_backlight_use_native() wrong.

---
 include/acpi/video.h | 9 +++++++++
 1 file changed, 9 insertions(+)
include/acpi/video.h +3 -0
index 4230392b5b0b..3d538d4178ab 100644
@@ -75,6 +75,15 @@ static inline enum acpi_backlight_type acpi_video_get_backlight_type(void)
        return __acpi_video_get_backlight_type(false, NULL);
 }
 
+/*
+ * This function MUST only be called by GPU drivers to check if the driver
+ * should register a backlight class device. This function not only checks

include/acpi/video.h static inline enum acpi_backlight_type acpi_video_get_backlight_type(void)

Quoted 10 lines
include/acpi/video.h +6 -1
+ * if a GPU native backlight device should be registered it *also* tells
+ * the ACPI video-detect code that native GPU backlight control is available.
+ * Therefor calling this from any place other then the GPU driver is wrong!
+ * To check if GPU native backlight control is used in other places instead use:
+ *   if (acpi_video_get_backlight_type() == acpi_backlight_native) { ... }
+ */
 static inline bool acpi_video_backlight_use_native(void)
 {
        return __acpi_video_get_backlight_type(true, NULL) == acpi_backlight_native;
--

Applied as 6.8 material, thanks!