[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <84616b3a-0ef1-f7df-378d-834075608b86@linux.intel.com>
Date: Wed, 15 Oct 2025 16:03:28 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Denis Benato <benato.denis96@...il.com>
cc: LKML <linux-kernel@...r.kernel.org>, platform-driver-x86@...r.kernel.org,
Hans de Goede <hdegoede@...hat.com>,
"Limonciello, Mario" <mario.limonciello@....com>,
"Luke D . Jones" <luke@...nes.dev>, Alok Tiwari <alok.a.tiwari@...cle.com>,
Derek John Clark <derekjohn.clark@...il.com>,
Mateusz Schyboll <dragonn@...pl>, porfet828@...il.com
Subject: Re: [PATCH v14 1/9] platform/x86: asus-wmi: export symbols used for
read/write WMI
On Wed, 15 Oct 2025, Denis Benato wrote:
> From: "Luke D. Jones" <luke@...nes.dev>
>
> Export symbols for reading/writing WMI symbols using a namespace.
> Existing functions:
> - asus_wmi_evaluate_method
> - asus_wmi_set_devstate
> New function:
> - asus_wmi_get_devstate_dsts
>
> The new function is intended for use with DSTS WMI method only and
> avoids requiring the asus_wmi driver data to select the WMI method.
>
> Signed-off-by: Denis Benato <benato.denis96@...il.com>
> Signed-off-by: Luke D. Jones <luke@...nes.dev>
> Reviewed-by: Mario Limonciello <mario.limonciello@....com>
> ---
> drivers/platform/x86/asus-wmi.c | 40 ++++++++++++++++++++--
> include/linux/platform_data/x86/asus-wmi.h | 5 +++
> 2 files changed, 42 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index e72a2b5d158e..38ab5306e05a 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -390,7 +390,7 @@ int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval)
> {
> return asus_wmi_evaluate_method3(method_id, arg0, arg1, 0, retval);
> }
> -EXPORT_SYMBOL_GPL(asus_wmi_evaluate_method);
> +EXPORT_SYMBOL_NS_GPL(asus_wmi_evaluate_method, "ASUS_WMI");
>
> static int asus_wmi_evaluate_method5(u32 method_id,
> u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 *retval)
> @@ -554,12 +554,46 @@ static int asus_wmi_get_devstate(struct asus_wmi *asus, u32 dev_id, u32 *retval)
> return 0;
> }
>
> -int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param,
> - u32 *retval)
> +/**
> + * asus_wmi_get_devstate_dsts() - Get the WMI function state.
> + * @dev_id: The WMI method ID to call.
> + * @retval: A pointer to where to store the value returned from WMI.
Please add empty line here (or just * to be precise).
> + * @return: 0 on success and retval is filled.
> + * @return: -ENODEV if the method ID is unsupported.
%0
%-ENODEV
Return:
I've never seen it used for more than one line. It's possible (I think) to
get the multi-line formatting with * *, please see
Documentation/doc-guide/kernel-doc.rst
> + * @return: everything else is an error from WMI call.
> + */
> +int asus_wmi_get_devstate_dsts(u32 dev_id, u32 *retval)
> +{
> + int err;
> +
> + err = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS, dev_id, 0, retval);
> + if (err)
> + return err;
> +
> + if (*retval == ASUS_WMI_UNSUPPORTED_METHOD)
> + return -ENODEV;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_NS_GPL(asus_wmi_get_devstate_dsts, "ASUS_WMI");
> +
> +/**
> + * asus_wmi_set_devstate() - Set the WMI function state.
> + * @dev_id: The WMI function to call.
> + * @ctrl_param: The argument to be used for this WMI function.
> + * @retval: A pointer to where to store the value returned from WMI.
> + * @return: 0 on success and retval is filled.
> + * @return: everything else is an error from WMI call.
> + *
> + * A asus_wmi_set_devstate() call must be paired with a
> + * asus_wmi_get_devstate_dsts() to check if the WMI function is supported.
Please put Return: as last (again, separating with an empty line from
the description).
> + */
> +int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param, u32 *retval)
> {
> return asus_wmi_evaluate_method(ASUS_WMI_METHODID_DEVS, dev_id,
> ctrl_param, retval);
> }
> +EXPORT_SYMBOL_NS_GPL(asus_wmi_set_devstate, "ASUS_WMI");
>
> /* Helper for special devices with magic return codes */
> static int asus_wmi_get_devstate_bits(struct asus_wmi *asus,
> diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
> index 8a515179113d..dbd44d9fbb6f 100644
> --- a/include/linux/platform_data/x86/asus-wmi.h
> +++ b/include/linux/platform_data/x86/asus-wmi.h
> @@ -166,6 +166,7 @@ enum asus_ally_mcu_hack {
> #if IS_REACHABLE(CONFIG_ASUS_WMI)
> void set_ally_mcu_hack(enum asus_ally_mcu_hack status);
> void set_ally_mcu_powersave(bool enabled);
> +int asus_wmi_get_devstate_dsts(u32 dev_id, u32 *retval);
> int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param, u32 *retval);
> int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval);
> #else
> @@ -179,6 +180,10 @@ static inline int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param, u32 *retval)
> {
> return -ENODEV;
> }
> +static inline int asus_wmi_get_devstate_dsts(u32 dev_id, u32 *retval)
> +{
> + return -ENODEV;
> +}
> static inline int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1,
> u32 *retval)
> {
>
--
i.
Powered by blists - more mailing lists