lkml.org 
[lkml]   [2023]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 2/4] platform/x86: wmi: Add to_wmi_device() helper macro
    Date
    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>
    ---
    include/linux/wmi.h | 8 ++++++++
    1 file changed, 8 insertions(+)

    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,
    --
    2.39.2
    \
     
     \ /
      Last update: 2023-11-02 05:31    [W:2.523 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site