All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Benato <denis.benato@linux.dev>
To: "Bartu Alev" <bartualev@gmail.com>,
	"Corentin Chary" <corentin.chary@gmail.com>,
	"Luke D. Jones" <luke@ljones.dev>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] platform/asus: asus-wmi: Document asus_wmi_evaluate_method_buf()
Date: Wed, 2 Dec 2026 03:50:59 +0100	[thread overview]
Message-ID: <177a8ebd-aabb-4178-8a7d-d8827a983e8f@linux.dev> (raw)
In-Reply-To: <20261202-asus-wmi-eval-buf-v1-3-640c12d437dc@gmail.com>


On 12/2/26 00:31, Bartu Alev wrote:
> Add kernel-doc for the helper: its parameters, the fact that only
> obj->buffer.length bytes are copied and the tail of ret_buffer is left
> untouched on short replies, and the meaning of every error return, i.e.
> -EIO when the evaluation fails, -ENODEV for the 0xfffffffe and 0xffffffff
> sentinels, -ENOSPC when the reply does not fit and -ENODATA for any other
> integer, a missing object or an unexpected type. The return values are
> listed as a ReST list as Documentation/doc-guide/kernel-doc.rst asks.
>
> Suggested-by: Denis Benato <denis.benato@linux.dev>
> Signed-off-by: Bartu Alev <bartualev@gmail.com>
> ---
>  drivers/platform/asus/asus-wmi.c | 29 ++++++++++++++++++++++++++---
>  1 file changed, 26 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/asus/asus-wmi.c b/drivers/platform/asus/asus-wmi.c
> index 015e207e840e6..4627ef0cad0c4 100644
> --- a/drivers/platform/asus/asus-wmi.c
> +++ b/drivers/platform/asus/asus-wmi.c
> @@ -462,9 +462,32 @@ static int asus_wmi_evaluate_method5(u32 method_id,
>  	return 0;
>  }
>  
> -/*
> - * Returns as an error if the method output is not a buffer. Typically this
> - * means that the method called is unsupported.
> +/**
> + * asus_wmi_evaluate_method_buf() - Evaluate a WMI method returning a buffer
> + * @method_id: WMI method ID to evaluate, such as ASUS_WMI_METHODID_DSTS
> + * @arg0: First method argument, usually the device ID
> + * @arg1: Second method argument
> + * @ret_buffer: Buffer to copy the reply into
> + * @size: Size of @ret_buffer
> + *
> + * Evaluate the method and copy the reply into @ret_buffer. The reply must
> + * be a non-empty ACPI buffer; only obj->buffer.length bytes are copied and
> + * the rest of @ret_buffer is left untouched, so callers that need the
> + * whole buffer must initialise it themselves. Anything other than a
> + * buffer is reported as an error. The firmware answers with an integer
> + * instead, %ASUS_WMI_UNSUPPORTED_METHOD (0xfffffffe) when it does not
> + * implement the device or method. That value and 0xffffffff, which
> + * asus_wmi_get_devstate() treats the same way, are reported as -ENODEV.
> + * No object at all, an empty buffer, an unexpected object type and any
> + * other integer, including the 0 some methods return when called without
> + * an argument, are reported as -ENODATA.
> + *

This is confusing to me, can you make it shorter?

"Anything other than a buffer is reported as an error"... anything what?
The answer?

The sentence "The firmware answers with an integer instead" doesn't
make sense to me, probably because it's too convoluted and mixing
implementation details, ACPI asus methods and function inner working.

> + * Return:
> + * * %0		- reply copied into @ret_buffer
> + * * %-EIO	- the WMI evaluation failed
> + * * %-ENODEV	- the firmware does not implement the device or method
> + * * %-ENOSPC	- the reply does not fit into @ret_buffer
> + * * %-ENODATA	- no object, an empty buffer, an unexpected type or another integer
>   */
>  static int asus_wmi_evaluate_method_buf(u32 method_id,
>  		u32 arg0, u32 arg1, u8 *ret_buffer, size_t size)
>

      reply	other threads:[~2026-12-02  2:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 23:31 [PATCH 0/3] platform/asus: asus-wmi: harden asus_wmi_evaluate_method_buf() Bartu Alev
2026-12-01 23:31 ` [PATCH 1/3] platform/asus: asus-wmi: Fix NULL deref and integer handling in asus_wmi_evaluate_method_buf() Bartu Alev
2026-12-02  2:40   ` Denis Benato
2026-12-01 23:31 ` [PATCH 2/3] platform/asus: asus-wmi: Use __free(kfree) " Bartu Alev
2026-12-02  2:45   ` Denis Benato
2026-12-01 23:31 ` [PATCH 3/3] platform/asus: asus-wmi: Document asus_wmi_evaluate_method_buf() Bartu Alev
2026-12-02  2:50   ` Denis Benato [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=177a8ebd-aabb-4178-8a7d-d8827a983e8f@linux.dev \
    --to=denis.benato@linux.dev \
    --cc=bartualev@gmail.com \
    --cc=corentin.chary@gmail.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke@ljones.dev \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.