[PATCH 3/3] platform/asus: asus-wmi: Document asus_wmi_evaluate_method_buf()
From: Bartu Alev
Date: Tue Dec 01 2026 - 18:32:12 EST
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@xxxxxxxxx>
Signed-off-by: Bartu Alev <bartualev@xxxxxxxxx>
---
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.
+ *
+ * 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)
--
2.56.1