Re: [PATCH v5 2/4] alienware-wmi: alienware_wmax_command() is now input size agnostic

From: Kurt Borja
Date: Mon Oct 14 2024 - 22:15:15 EST


On Mon, Oct 14, 2024 at 06:30:21PM +0200, Armin Wolf wrote:
> Am 12.10.24 um 04:01 schrieb Kurt Borja:
>
> > alienware_wmax_command() now takes void * and size_t instead of struct
> > wmax_basic_args to extend support to new WMAX methods. Also int *out_data
> > was changed to u32 *out_data, because new interface specifies u32 as output
> > parameter and all previous callers would pass u32 * regardless.
>
> Reviewed-by: Armin Wolf <W_Armin@xxxxxx>
>

Thank you very much.

Kurt

> > Signed-off-by: Kurt Borja <kuurtb@xxxxxxxxx>
> > ---
> > drivers/platform/x86/dell/alienware-wmi.c | 29 ++++++++++++-----------
> > 1 file changed, 15 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c
> > index 16a3fe9ac..b27f3b64c 100644
> > --- a/drivers/platform/x86/dell/alienware-wmi.c
> > +++ b/drivers/platform/x86/dell/alienware-wmi.c
> > @@ -500,15 +500,15 @@ static void alienware_zone_exit(struct platform_device *dev)
> > kfree(zone_attrs);
> > }
> >
> > -static acpi_status alienware_wmax_command(struct wmax_basic_args *in_args,
> > - u32 command, int *out_data)
> > +static acpi_status alienware_wmax_command(void *in_args, size_t in_size,
> > + u32 command, u32 *out_data)
> > {
> > acpi_status status;
> > union acpi_object *obj;
> > struct acpi_buffer input;
> > struct acpi_buffer output;
> >
> > - input.length = sizeof(*in_args);
> > + input.length = in_size;
> > input.pointer = in_args;
> > if (out_data) {
> > output.length = ACPI_ALLOCATE_BUFFER;
> > @@ -541,8 +541,8 @@ static ssize_t show_hdmi_cable(struct device *dev,
> > .arg = 0,
> > };
> > status =
> > - alienware_wmax_command(&in_args, WMAX_METHOD_HDMI_CABLE,
> > - &out_data);
> > + alienware_wmax_command(&in_args, sizeof(in_args),
> > + WMAX_METHOD_HDMI_CABLE, &out_data);
> > if (ACPI_SUCCESS(status)) {
> > if (out_data == 0)
> > return sysfs_emit(buf, "[unconnected] connected unknown\n");
> > @@ -562,8 +562,8 @@ static ssize_t show_hdmi_source(struct device *dev,
> > .arg = 0,
> > };
> > status =
> > - alienware_wmax_command(&in_args, WMAX_METHOD_HDMI_STATUS,
> > - &out_data);
> > + alienware_wmax_command(&in_args, sizeof(in_args),
> > + WMAX_METHOD_HDMI_STATUS, &out_data);
> >
> > if (ACPI_SUCCESS(status)) {
> > if (out_data == 1)
> > @@ -589,7 +589,8 @@ static ssize_t toggle_hdmi_source(struct device *dev,
> > args.arg = 3;
> > pr_debug("alienware-wmi: setting hdmi to %d : %s", args.arg, buf);
> >
> > - status = alienware_wmax_command(&args, WMAX_METHOD_HDMI_SOURCE, NULL);
> > + status = alienware_wmax_command(&args, sizeof(args),
> > + WMAX_METHOD_HDMI_SOURCE, NULL);
> >
> > if (ACPI_FAILURE(status))
> > pr_err("alienware-wmi: HDMI toggle failed: results: %u\n",
> > @@ -642,8 +643,8 @@ static ssize_t show_amplifier_status(struct device *dev,
> > .arg = 0,
> > };
> > status =
> > - alienware_wmax_command(&in_args, WMAX_METHOD_AMPLIFIER_CABLE,
> > - &out_data);
> > + alienware_wmax_command(&in_args, sizeof(in_args),
> > + WMAX_METHOD_AMPLIFIER_CABLE, &out_data);
> > if (ACPI_SUCCESS(status)) {
> > if (out_data == 0)
> > return sysfs_emit(buf, "[unconnected] connected unknown\n");
> > @@ -694,8 +695,8 @@ static ssize_t show_deepsleep_status(struct device *dev,
> > struct wmax_basic_args in_args = {
> > .arg = 0,
> > };
> > - status = alienware_wmax_command(&in_args, WMAX_METHOD_DEEP_SLEEP_STATUS,
> > - &out_data);
> > + status = alienware_wmax_command(&in_args, sizeof(in_args),
> > + WMAX_METHOD_DEEP_SLEEP_STATUS, &out_data);
> > if (ACPI_SUCCESS(status)) {
> > if (out_data == 0)
> > return sysfs_emit(buf, "[disabled] s5 s5_s4\n");
> > @@ -723,8 +724,8 @@ static ssize_t toggle_deepsleep(struct device *dev,
> > args.arg = 2;
> > pr_debug("alienware-wmi: setting deep sleep to %d : %s", args.arg, buf);
> >
> > - status = alienware_wmax_command(&args, WMAX_METHOD_DEEP_SLEEP_CONTROL,
> > - NULL);
> > + status = alienware_wmax_command(&args, sizeof(args),
> > + WMAX_METHOD_DEEP_SLEEP_CONTROL, NULL);
> >
> > if (ACPI_FAILURE(status))
> > pr_err("alienware-wmi: deep sleep control failed: results: %u\n",