mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: "Luke D. Jones" <luke@ljones.dev>, platform-driver-x86@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, ilpo.jarvinen@linux.intel.com,
	corentin.chary@gmail.com
Subject: Re: [PATCH v2] platform/x86: asus-wmi: don't fail if platform_profile already registered
Date: Tue, 6 Aug 2024 11:40:53 +0200	[thread overview]
Message-ID: <53e1e46c-b75e-4f64-bd7d-c56cad1981e8@redhat.com> (raw)
In-Reply-To: <20240805235808.40944-1-luke@ljones.dev>

Hi Luke,

On 8/6/24 1:58 AM, Luke D. Jones wrote:
> On some newer laptops it appears that an AMD driver can register 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 cc5dc296fb2d..2fdfa84f7efb 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -3897,8 +3897,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("A platform_profile handler is already registered, this may be a driver conflict.\n");
> +		return 0;
> +	} else if (err) {
> +		pr_err("Failed to register platform_profile: %d\n", err);
>  		return err;
> +	}
>  
>  	asus->platform_profile_support = true;
>  	return 0;
> @@ -4773,7 +4778,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)
>  		goto fail_platform_profile_setup;

Since you already do "return 0" on EEXIST in platform_profile_setup() there
is no need for this part of the patch.

Regards,

Hans



>  
>  	err = asus_wmi_sysfs_init(asus->platform_device);


      reply	other threads:[~2024-08-06  9:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-05 23:58 Luke D. Jones
2024-08-06  9:40 ` Hans de Goede [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=53e1e46c-b75e-4f64-bd7d-c56cad1981e8@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=corentin.chary@gmail.com \
    --cc=ilpo.jarvinen@linux.intel.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

all inboxes | Powered by JetHome®