History

platform/x86: wmi: Add function to get _UID of WMI device

Add a new function to acpi.h / wmi.c that returns _UID of the ACPI WMI device. For example, it returns "ATK" for the following declaration in DSDT: Device (ATKD) { Name (_HID, "PNP0C14" /* Windows Management Instrumentation Device */) // _HID: Hardware ID Name (_UID, "ATK") // _UID: Unique ID .. Generally, it is possible that multiple PNP0C14 ACPI devices are present in the system as mentioned in the commit message of commit bff431e49ff5 ("ACPI: WMI: Add ACPI-WMI mapping driver"). Therefore the _UID is returned for a specific ACPI device that declares the given GUID, to which it is also mapped by other methods of wmi module.

Yurii Pavlovskyi committed 7 years ago

Commit e7488e51 parent 98e865a2 files · +20 −0Browse files

Unified · Split

2 files
  1. drivers/platform/x86/wmi.c +19 −0
  2. include/linux/acpi.h +1 −0
drivers/platform/x86/wmi.c+19−0
@@ -635,6 +635,25 @@ bool wmi_has_guid(const char *guid_string) · 634 unmodified lines
635635 }
636636 EXPORT_SYMBOL_GPL(wmi_has_guid);
637637
638+/**
639+ * wmi_get_acpi_device_uid() - Get _UID name of ACPI device that defines GUID
640+ * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
641+ *
642+ * Find the _UID of ACPI device associated with this WMI GUID.
643+ *
644+ * Return: The ACPI _UID field value or NULL if the WMI GUID was not found
645+ */
646+char *wmi_get_acpi_device_uid(const char *guid_string)
647+{
648+ struct wmi_block *wblock = NULL;
649+
650+ if (!find_guid(guid_string, &wblock))
651+ return NULL;
652+
653+ return acpi_device_uid(wblock->acpi_device);
654+}
655+EXPORT_SYMBOL_GPL(wmi_get_acpi_device_uid);
656+
638657 static struct wmi_block *dev_to_wblock(struct device *dev)
639658 {
640659 return container_of(dev, struct wmi_block, dev.dev);
include/linux/acpi.h+1−0
@@ -380,6 +380,7 @@ extern acpi_status wmi_install_notify_handler(const char *guid, · 379 unmodified lines
380380 extern acpi_status wmi_remove_notify_handler(const char *guid);
381381 extern acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out);
382382 extern bool wmi_has_guid(const char *guid);
383+extern char *wmi_get_acpi_device_uid(const char *guid);
383384
384385 #endif /* CONFIG_ACPI_WMI */
385386

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t