summaryrefslogtreecommitdiff
path: root/include/linux/wmi.h
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2024-03-26 12:08:35 +0000
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2024-03-26 12:08:35 +0000
commitf843bc9bc952bdeb21586ee921d29f5c2ae5a863 (patch)
tree05daf639c7add0e0fcb94f65143f10d7d87bd0b5 /include/linux/wmi.h
parent3c688a55831db128cc709396992886396d4f1654 (diff)
parent3d5a640ecf92e4c8d6e157849217b68984a819bc (diff)
Merge branches 'sa1100-for-next' and 'unstable/sa11x0-asoc' into sa1100
Diffstat (limited to 'include/linux/wmi.h')
-rw-r--r--include/linux/wmi.h53
1 files changed, 45 insertions, 8 deletions
diff --git a/include/linux/wmi.h b/include/linux/wmi.h
index b88d7b58e61e..686291b87852 100644
--- a/include/linux/wmi.h
+++ b/include/linux/wmi.h
@@ -11,27 +11,50 @@
#include <linux/device.h>
#include <linux/acpi.h>
#include <linux/mod_devicetable.h>
-#include <uapi/linux/wmi.h>
+/**
+ * struct wmi_device - WMI device structure
+ * @dev: Device associated with this WMI device
+ * @setable: True for devices implementing the Set Control Method
+ *
+ * This represents WMI devices discovered by the WMI driver core.
+ */
struct wmi_device {
struct device dev;
-
- /* True for data blocks implementing the Set Control Method */
bool setable;
};
-/* evaluate the ACPI method associated with this device */
+/**
+ * to_wmi_device() - Helper macro to cast a device to a wmi_device
+ * @device: device struct
+ *
+ * Cast a struct device to a struct wmi_device.
+ */
+#define to_wmi_device(device) container_of(device, struct wmi_device, dev)
+
extern acpi_status wmidev_evaluate_method(struct wmi_device *wdev,
u8 instance, u32 method_id,
const struct acpi_buffer *in,
struct acpi_buffer *out);
-/* Caller must kfree the result. */
extern union acpi_object *wmidev_block_query(struct wmi_device *wdev,
u8 instance);
-extern int set_required_buffer_size(struct wmi_device *wdev, u64 length);
+acpi_status wmidev_block_set(struct wmi_device *wdev, u8 instance, const struct acpi_buffer *in);
+
+u8 wmidev_instance_count(struct wmi_device *wdev);
+/**
+ * struct wmi_driver - WMI driver structure
+ * @driver: Driver model structure
+ * @id_table: List of WMI GUIDs supported by this driver
+ * @no_notify_data: WMI events provide no event data
+ * @probe: Callback for device binding
+ * @remove: Callback for device unbinding
+ * @notify: Callback for receiving WMI events
+ *
+ * This represents WMI drivers which handle WMI devices.
+ */
struct wmi_driver {
struct device_driver driver;
const struct wmi_device_id *id_table;
@@ -40,15 +63,29 @@ struct wmi_driver {
int (*probe)(struct wmi_device *wdev, const void *context);
void (*remove)(struct wmi_device *wdev);
void (*notify)(struct wmi_device *device, union acpi_object *data);
- long (*filter_callback)(struct wmi_device *wdev, unsigned int cmd,
- struct wmi_ioctl_buffer *arg);
};
extern int __must_check __wmi_driver_register(struct wmi_driver *driver,
struct module *owner);
extern void wmi_driver_unregister(struct wmi_driver *driver);
+
+/**
+ * wmi_driver_register() - Helper macro to register a WMI driver
+ * @driver: wmi_driver struct
+ *
+ * Helper macro for registering a WMI driver. It automatically passes
+ * THIS_MODULE to the underlying function.
+ */
#define wmi_driver_register(driver) __wmi_driver_register((driver), THIS_MODULE)
+/**
+ * module_wmi_driver() - Helper macro to register/unregister a WMI driver
+ * @__wmi_driver: wmi_driver struct
+ *
+ * Helper macro for WMI drivers which do not do anything special in module
+ * init/exit. This eliminates a lot of boilerplate. Each module may only
+ * use this macro once, and calling it replaces module_init() and module_exit().
+ */
#define module_wmi_driver(__wmi_driver) \
module_driver(__wmi_driver, wmi_driver_register, \
wmi_driver_unregister)