From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Jackie Dong <xy-jackie@139.com>
Cc: hansg@kernel.org, platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
dongeg1@lenovo.com
Subject: Re: [PATCH v4] lenovo-wmi-hotkey: Fixed a kernel bug failed with error -5
Date: Wed, 9 Jul 2025 11:58:26 +0300 (EEST) [thread overview]
Message-ID: <3c6f550d-6db4-66d4-f19c-59759450d454@linux.intel.com> (raw)
In-Reply-To: <20250709035716.36267-1-xy-jackie@139.com>
On Wed, 9 Jul 2025, Jackie Dong wrote:
> Not all of Lenovo non-ThinkPad devices support both mic mute LED (on F4)
> and audio mute LED (on F1). Some of them only support one mute LED, some
> of them don't have any mute LED. Add a decision to judge this device
> support mute LED or not. Without this decision, not support both of mic
> mute LED and audio mute LED Lenovo non-ThinkPad brand devices (including
> Ideapad/Yoga/Xiaoxin/Gaming/ThinkBook, etc.) will report a failed message
> with error -5.
>
> Signed-off-by: Jackie Dong <xy-jackie@139.com>
> Suggested-by: Hans de Goede <hansg@kernel.org>
Thanks. I applied this to the review-ilpo-fixes branch after doing major
rephrasing to the changelog.
--
i.
> ---
> Changes in v4:
> - Simplify the logic code as (!obj || obj->type != ACPI_TYPE_INTEGER).
> - Drop "now" of the warning messages.
>
> Changes in v3:
> - Reverse orignal logic (obj && obj->type == ACPI_TYPE_INTEGER)
> and add new decision for (led_version == 0).
> - Optimize the descriptions based on reviewer comments.
>
> Changes in v2:
> - Add warning message and then return 0 if the device support mute LED
> abnormaly, based on Hans suggestion and Armin previous patch.
>
> ---
> .../x86/lenovo-wmi-hotkey-utilities.c | 30 +++++++++++++------
> 1 file changed, 21 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/platform/x86/lenovo-wmi-hotkey-utilities.c b/drivers/platform/x86/lenovo-wmi-hotkey-utilities.c
> index 89153afd7015..7b9bad1978ff 100644
> --- a/drivers/platform/x86/lenovo-wmi-hotkey-utilities.c
> +++ b/drivers/platform/x86/lenovo-wmi-hotkey-utilities.c
> @@ -122,26 +122,35 @@ static int lenovo_super_hotkey_wmi_led_init(enum mute_led_type led_type, struct
> return -EIO;
>
> union acpi_object *obj __free(kfree) = output.pointer;
> - if (obj && obj->type == ACPI_TYPE_INTEGER)
> - led_version = obj->integer.value;
> - else
> + if (!obj || obj->type != ACPI_TYPE_INTEGER)
> return -EIO;
>
> - wpriv->cdev[led_type].max_brightness = LED_ON;
> - wpriv->cdev[led_type].flags = LED_CORE_SUSPENDRESUME;
> + led_version = obj->integer.value;
> +
> + /*
> + * Output parameters define: 0 means mute LED is not supported, Non-zero means
> + * mute LED can be supported.
> + */
> + if (led_version == 0)
> + return 0;
> +
>
> switch (led_type) {
> case MIC_MUTE:
> - if (led_version != WMI_LUD_SUPPORT_MICMUTE_LED_VER)
> - return -EIO;
> + if (led_version != WMI_LUD_SUPPORT_MICMUTE_LED_VER) {
> + pr_warn("The MIC_MUTE LED of this device isn't supported.\n");
> + return 0;
> + }
>
> wpriv->cdev[led_type].name = "platform::micmute";
> wpriv->cdev[led_type].brightness_set_blocking = &lsh_wmi_micmute_led_set;
> wpriv->cdev[led_type].default_trigger = "audio-micmute";
> break;
> case AUDIO_MUTE:
> - if (led_version != WMI_LUD_SUPPORT_AUDIOMUTE_LED_VER)
> - return -EIO;
> + if (led_version != WMI_LUD_SUPPORT_AUDIOMUTE_LED_VER) {
> + pr_warn("The AUDIO_MUTE LED of this device isn't supported.\n");
> + return 0;
> + }
>
> wpriv->cdev[led_type].name = "platform::mute";
> wpriv->cdev[led_type].brightness_set_blocking = &lsh_wmi_audiomute_led_set;
> @@ -152,6 +161,9 @@ static int lenovo_super_hotkey_wmi_led_init(enum mute_led_type led_type, struct
> return -EINVAL;
> }
>
> + wpriv->cdev[led_type].max_brightness = LED_ON;
> + wpriv->cdev[led_type].flags = LED_CORE_SUSPENDRESUME;
> +
> err = devm_led_classdev_register(dev, &wpriv->cdev[led_type]);
> if (err < 0) {
> dev_err(dev, "Could not register mute LED %d : %d\n", led_type, err);
>
prev parent reply other threads:[~2025-07-09 8:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-09 3:57 Jackie Dong
2025-07-09 8:58 ` Ilpo Järvinen [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=3c6f550d-6db4-66d4-f19c-59759450d454@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=dongeg1@lenovo.com \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=xy-jackie@139.com \
/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
all inboxes | Powered by JetHome®