[PATCH v2 1/6] ACPI: utils: Introduce acpi_dev_is_video_device() helper
From: Andy Shevchenko
Date: Tue Jul 14 2026 - 15:02:38 EST
There are a couple of users that open code functionality of matching
a given handle against ACPI video device IDs. The current approach
duplicates ID table along with the matching code. Consolidate it
under the acpi_dev_is_video_device() helper's hood.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
drivers/acpi/utils.c | 17 +++++++++++++++++
include/linux/acpi.h | 1 +
2 files changed, 18 insertions(+)
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 6ab27e4826d1..8b3e49f3cefa 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -1047,6 +1047,23 @@ static int __init acpi_backlight(char *str)
}
__setup("acpi_backlight=", acpi_backlight);
+static const struct acpi_device_id video_device_ids[] = {
+ { .id = ACPI_VIDEO_HID },
+ { }
+};
+
+/**
+ * acpi_dev_is_video_device - test if device matches against ACPI video device IDs
+ * @adev: ACPI device to test
+ *
+ * Return: true when matches, otherwise false.
+ */
+bool acpi_dev_is_video_device(struct acpi_device *adev)
+{
+ return adev && !acpi_match_device_ids(adev, video_device_ids);
+}
+EXPORT_SYMBOL(acpi_dev_is_video_device);
+
/**
* acpi_match_platform_list - Check if the system matches with a given list
* @plat: pointer to acpi_platform_list table terminated by a NULL entry
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 899dc00b4b01..99afad0eb49e 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -457,6 +457,7 @@ extern char *wmi_get_acpi_device_uid(const char *guid);
#define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800
extern char acpi_video_backlight_string[];
+extern bool acpi_dev_is_video_device(struct acpi_device *adev);
extern long acpi_is_video_device(acpi_handle handle);
extern void acpi_osi_setup(char *str);
--
2.50.1