summaryrefslogtreecommitdiff
path: root/include/linux/wmi.h
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@kernel.org>2015-11-24 19:49:23 -0800
committerDarren Hart (VMware) <dvhart@infradead.org>2017-06-06 10:15:18 -0700
commit844af950da946cfab227a04b950614da04cb6275 (patch)
tree4bb4e0aa002cc1566cfc08b87ec274c094b06bbe /include/linux/wmi.h
parentb0e86302973d9e710c722a8436cc7e099d2a5b0d (diff)
platform/x86: wmi: Turn WMI into a bus driver
WMI is logically a bus: the WMI driver binds to an ACPI node (or more than one), and each instance of the WMI driver enumerates its children and hopes that drivers will attach to the children that are useful. This patch gives WMI a driver model bus type and the ability to match to drivers. The bus itself is a device in the new "wmi_bus" class, and all of the individual WMI devices are slotted into the device hierarchy correctly. Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Mario Limonciello <mario_limonciello@dell.com> Cc: Pali Rohár <pali.rohar@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-acpi@vger.kernel.org Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Diffstat (limited to 'include/linux/wmi.h')
-rw-r--r--include/linux/wmi.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/include/linux/wmi.h b/include/linux/wmi.h
new file mode 100644
index 000000000000..29ed34b4dae1
--- /dev/null
+++ b/include/linux/wmi.h
@@ -0,0 +1,47 @@
+/*
+ * wmi.h - ACPI WMI interface
+ *
+ * Copyright (c) 2015 Andrew Lutomirski
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#ifndef _LINUX_WMI_H
+#define _LINUX_WMI_H
+
+#include <linux/device.h>
+#include <linux/acpi.h>
+
+struct wmi_device {
+ struct device dev;
+};
+
+struct wmi_device_id {
+ const char *guid_string;
+};
+
+struct wmi_driver {
+ struct device_driver driver;
+ const struct wmi_device_id *id_table;
+
+ int (*probe)(struct wmi_device *wdev);
+ int (*remove)(struct wmi_device *wdev);
+};
+
+extern int __must_check __wmi_driver_register(struct wmi_driver *driver,
+ struct module *owner);
+extern void wmi_driver_unregister(struct wmi_driver *driver);
+#define wmi_driver_register(driver) __wmi_driver_register((driver), THIS_MODULE)
+
+#define module_wmi_driver(__wmi_driver) \
+ module_driver(__wmi_driver, wmi_driver_register, \
+ wmi_driver_unregister)
+
+#endif