ACPI: utils: Introduce acpi_dev_is_video_device() helper

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@linux.intel.com>
[ rjw: Moved the static var declaration into the function body ]
Link: https://patch.msgid.link/20260714185915.865396-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Andy Shevchenko
2026-07-21 15:37:50 +02:00
committed by Rafael J. Wysocki
parent c01576a7f5
commit c75c99aafe
2 changed files with 18 additions and 0 deletions
+17
View File
@@ -1047,6 +1047,23 @@ static int __init acpi_backlight(char *str)
}
__setup("acpi_backlight=", acpi_backlight);
/**
* 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)
{
static const struct acpi_device_id video_device_ids[] = {
{ .id = ACPI_VIDEO_HID },
{ }
};
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
+1
View File
@@ -448,6 +448,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);