From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Kurt Borja <kuurtb@gmail.com>
Cc: platform-driver-x86@vger.kernel.org,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Armin Wolf" <W_Armin@gmx.de>,
"Mario Limonciello" <mario.limonciello@amd.com>,
"Hans de Goede" <hdegoede@redhat.com>,
Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v10 04/14] platform/x86: alienware-wmi: Refactor LED control methods
Date: Tue, 11 Feb 2025 18:33:46 +0200 [thread overview]
Message-ID: <Z6t76t_4nIXwFX5Q@black.fi.intel.com> (raw)
In-Reply-To: <20250207154610.13675-5-kuurtb@gmail.com>
On Fri, Feb 07, 2025 at 10:46:00AM -0500, Kurt Borja wrote:
> Both WMI devices handled by this module specify a distinct interface for
> LED control. Previously this module handled this by dynamically adapting
> arguments passed to wmi_evaluate_method() based on the `interface`
> global variable.
>
> To avoid the use of global variables, and enable the migration to
> non-deprecated WMI methods, let the WMI drivers define upd_led and
> upd_brightness operations, which completely replace
> alienware_update_led() and wmax_brightness().
>
> Also define alienware_wmi_command(), which serves as a wrapper for
> wmidev_evaluate_method(). This new method is very similar to
> alienware_wmax_command() but is WMI device agnostic.
...
> +static int alienware_wmi_command(struct wmi_device *wdev, u32 method_id,
> + void *in_args, size_t in_size, u32 *out_data)
> +{
> + struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL};
> + struct acpi_buffer in = {in_size, in_args};
> + acpi_status ret;
> +
> + ret = wmidev_evaluate_method(wdev, 0, method_id, &in, out_data ? &out : NULL);
> + if (ACPI_FAILURE(ret))
> + return -EIO;
> +
> + union acpi_object *obj __free(kfree) = out.pointer;
Actually we have ACPI_FREE(), but it's not big deal (as of today) to use kfree().
> + if (out_data) {
> + if (obj && obj->type == ACPI_TYPE_INTEGER)
> + *out_data = (u32)obj->integer.value;
Unneeded casting.
> + else
> + return -ENOMSG;
> + }
> +
> + return 0;
> +}
...
> + if (legacy_args.state != LEGACY_RUNNING) {
With inverted conditional and duplicated line it will all look better.
> + legacy_args.state = priv->lighting_control_state;
> +
> + input.length = sizeof(legacy_args);
> + input.pointer = &legacy_args;
> +
> + status = wmi_evaluate_method(LEGACY_POWER_CONTROL_GUID, 0,
> + location + 1, &input, NULL);
> + if (ACPI_FAILURE(status))
> + return -EIO;
> +
> + return 0;
> + }
> +
> + return alienware_wmi_command(wdev, location + 1, &legacy_args,
> + sizeof(legacy_args), NULL);
...
> +static int wmax_wmi_update_brightness(struct alienfx_priv *priv,
> + struct wmi_device *wdev, u8 brightness)
> +{
> + struct wmax_brightness_args in_args = {
> + .led_mask = 0xFF,
GENMASK()?
> + .percentage = brightness,
> + };
> +
> + return alienware_wmi_command(wdev, WMAX_METHOD_BRIGHTNESS, &in_args,
> + sizeof(in_args), NULL);
> +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-02-11 16:33 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 15:45 [PATCH v10 00/14] platform/x86: alienware-wmi driver rework Kurt Borja
2025-02-07 15:45 ` [PATCH v10 01/14] platform/x86: alienware-wmi: Add a state container for LED control feature Kurt Borja
2025-02-07 15:45 ` [PATCH v10 02/14] platform/x86: alienware-wmi: Add WMI Drivers Kurt Borja
2025-02-11 16:30 ` Andy Shevchenko
2025-02-11 17:46 ` Kurt Borja
2025-02-11 18:51 ` Andy Shevchenko
2025-02-07 15:45 ` [PATCH v10 03/14] platform/x86: alienware-wmi: Add a state container for thermal control methods Kurt Borja
2025-02-07 15:46 ` [PATCH v10 04/14] platform/x86: alienware-wmi: Refactor LED " Kurt Borja
2025-02-11 16:33 ` Andy Shevchenko [this message]
2025-02-11 17:47 ` Kurt Borja
2025-02-07 15:46 ` [PATCH v10 05/14] platform/x86: alienware-wmi: Refactor hdmi, amplifier, deepslp methods Kurt Borja
2025-02-11 16:37 ` Andy Shevchenko
2025-02-11 17:51 ` Kurt Borja
2025-02-11 18:55 ` Andy Shevchenko
2025-02-07 15:46 ` [PATCH v10 06/14] platform/x86: alienware-wmi: Refactor thermal control methods Kurt Borja
2025-02-07 15:46 ` [PATCH v10 07/14] platform/x86: alienware-wmi: Split DMI table Kurt Borja
2025-02-11 16:39 ` Andy Shevchenko
2025-02-11 17:53 ` Kurt Borja
2025-02-07 15:46 ` [PATCH v10 08/14] MAINTAINERS: Update ALIENWARE WMI DRIVER entry Kurt Borja
2025-02-07 15:46 ` [PATCH v10 09/14] platform/x86: Rename alienware-wmi.c Kurt Borja
2025-02-11 16:41 ` Andy Shevchenko
2025-02-11 17:31 ` Kurt Borja
2025-02-11 18:50 ` Andy Shevchenko
2025-02-07 15:46 ` [PATCH v10 10/14] platform/x86: Add alienware-wmi.h Kurt Borja
2025-02-11 16:45 ` Andy Shevchenko
2025-02-11 16:51 ` Ilpo Järvinen
2025-02-11 17:19 ` Andy Shevchenko
2025-02-11 17:53 ` Kurt Borja
2025-02-07 15:46 ` [PATCH v10 11/14] platform/x86: Split the alienware-wmi driver Kurt Borja
2025-02-11 16:56 ` Andy Shevchenko
2025-02-11 17:59 ` Kurt Borja
2025-02-11 19:04 ` Andy Shevchenko
2025-02-14 22:21 ` Kurt Borja
2025-02-16 20:35 ` Andy Shevchenko
2025-02-07 15:46 ` [PATCH v10 12/14] platform/x86: dell: Modify Makefile alignment Kurt Borja
2025-02-11 16:56 ` Andy Shevchenko
2025-02-07 15:46 ` [PATCH v10 13/14] platform/x86: Update alienware-wmi config entries Kurt Borja
2025-02-07 15:46 ` [PATCH v10 14/14] platform/x86: alienware-wmi: Update header and module information Kurt Borja
2025-02-10 11:53 ` [PATCH v10 00/14] platform/x86: alienware-wmi driver rework Ilpo Järvinen
2025-02-10 13:48 ` Kurt Borja
2025-02-11 16:58 ` Andy Shevchenko
2025-02-11 18:09 ` Kurt Borja
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=Z6t76t_4nIXwFX5Q@black.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=Dell.Client.Kernel@dell.com \
--cc=W_Armin@gmx.de \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kuurtb@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox