diff options
author | Armin Wolf <W_Armin@gmx.de> | 2023-11-03 19:25:24 +0100 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2023-11-20 13:20:33 +0100 |
commit | 7275bf3e09578e1761157e7683f2e898c5c235a6 (patch) | |
tree | 804cd2f8f81770027d7633d3e2824b9b089a1b70 /include/linux/wmi.h | |
parent | f25d34646bd01505a0989ca67bc9a37390cae755 (diff) |
platform/x86: wmi: Add to_wmi_device() helper macro
Add a helper macro for WMI drivers to cast a device to
the corresponding WMI device. This should replace some
boilerplate code.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20231103182526.3524-2-W_Armin@gmx.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'include/linux/wmi.h')
-rw-r--r-- | include/linux/wmi.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/wmi.h b/include/linux/wmi.h index 207544968268..8a643c39fcce 100644 --- a/include/linux/wmi.h +++ b/include/linux/wmi.h @@ -27,6 +27,14 @@ struct wmi_device { bool setable; }; +/** + * 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, |