mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Luke Jones" <luke@ljones.dev>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org, corentin.chary@gmail.com,
	"Hans de Goede" <hdegoede@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] platform/x86: asus-wmi: don't fail if platform_profile already registered
Date: Tue, 06 Aug 2024 11:55:43 +1200	[thread overview]
Message-ID: <14b9f092-3118-4c71-8ad8-c40ac983abbe@app.fastmail.com> (raw)
In-Reply-To: <8533dbf2-05cf-9747-c61c-e57fd7bbdc4b@linux.intel.com>

On Tue, 30 Jul 2024, at 3:45 AM, Ilpo Järvinen wrote:
> On Sat, 13 Jul 2024, 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 4c129881ce28..7d87ff68f418 100644
> > --- a/drivers/platform/x86/asus-wmi.c
> > +++ b/drivers/platform/x86/asus-wmi.c
> > @@ -3836,8 +3836,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);
> 
> Please don't print __func__ to user in warnings or errors, and try to 
> write in English what is the reason (instead of resorting to use function 
> names).

Sorry, I do know this. The patch must have been submitted after your advice on it last time. Not sure.

In either case v2 incoming. I'll skip cover letter due to the tiny size.
 
> >  return err;
> > + }
> >  
> >  asus->platform_profile_support = true;
> >  return 0;
> > @@ -4713,7 +4718,7 @@ static int asus_wmi_add(struct platform_device *pdev)
> >  throttle_thermal_policy_set_default(asus);
> >  
> >  err = platform_profile_setup(asus);
> > - if (err)
> > + if (err && err != -EEXIST)
> >  goto fail_platform_profile_setup;
> >  
> >  err = asus_wmi_sysfs_init(asus->platform_device);
> > 
> 
> 

      reply	other threads:[~2024-08-05 23:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-13  7:59 [PATCH 0/2] platform/x86: asus-wmi: extra debugging and a fix Luke D. Jones
2024-07-13  7:59 ` [PATCH 1/2] platform/x86: asus-wmi: add debug print in more key places Luke D. Jones
2024-07-13  7:59 ` [PATCH 2/2] platform/x86: asus-wmi: don't fail if platform_profile already registered Luke D. Jones
2024-07-29 15:45   ` Ilpo Järvinen
2024-08-05 23:55     ` Luke Jones [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=14b9f092-3118-4c71-8ad8-c40ac983abbe@app.fastmail.com \
    --to=luke@ljones.dev \
    --cc=corentin.chary@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --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®