From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Luke D. Jones" <luke@ljones.dev>
Cc: platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
Hans de Goede <hdegoede@redhat.com>,
corentin.chary@gmail.com
Subject: Re: [PATCH] platform/x86: asus-wmi: don't fail if platform_profile already registered
Date: Tue, 10 Sep 2024 12:39:25 +0300 (EEST) [thread overview]
Message-ID: <baebdb06-0ada-cab0-b9c3-154346be4e72@linux.intel.com> (raw)
In-Reply-To: <20240910045443.678145-1-luke@ljones.dev>
On Tue, 10 Sep 2024, Luke D. Jones wrote:
> On some newer laptops ASUS laptops SPS support is advertised but not
> actually used, causing the AMD driver to register as a platform_profile
> handler.
>
> If this happens then the asus_wmi driver would error with -EEXIST when
> trying to register its own handler leaving the user with a possibly
> unusable system. This is especially true for laptops with an MCU that emit
> a stream of HID packets, some of which can be misinterpreted as shutdown
> signals.
>
> We can safely continue loading the driver instead of bombing out.
>
> Signed-off-by: Luke D. Jones <luke@ljones.dev>
> ---
> drivers/platform/x86/asus-wmi.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index fbb3345cc65a..d53c4aff519f 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -3876,8 +3876,13 @@ static int platform_profile_setup(struct asus_wmi *asus)
> asus->platform_profile_handler.choices);
>
> err = platform_profile_register(&asus->platform_profile_handler);
> - if (err)
> + if (err == -EEXIST) {
> + pr_warn("%s, a platform_profile handler is already registered\n", __func__);
> + return 0;
> + } else if (err) {
> + pr_err("%s, failed at platform_profile_register: %d\n", __func__, err);
Don't print __func__ in user visible warn/error/info messages but use
plain English please.
> return err;
> + }
>
> asus->platform_profile_support = true;
> return 0;
> @@ -4752,7 +4757,7 @@ static int asus_wmi_add(struct platform_device *pdev)
> goto fail_fan_boost_mode;
>
> err = platform_profile_setup(asus);
> - if (err)
> + if (err && err != -EEXIST)
Hi Luke,
Hans had a comment about this line against the previous version.
Also, this patch has entirely lost the version information. It's v3 now I
think.
--
i.
next prev parent reply other threads:[~2024-09-10 9:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 4:54 [PATCH] platform/x86: asus-wmi: don't fail if platform_profile already registered Luke D. Jones
2024-09-10 9:39 ` Ilpo Järvinen [this message]
2024-09-10 11:04 ` Luke Jones
2024-09-11 12:32 ` Hans de Goede
2024-09-17 8:45 ` Luke Jones
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=baebdb06-0ada-cab0-b9c3-154346be4e72@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=corentin.chary@gmail.com \
--cc=hdegoede@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox