linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Derek John Clark <derekjohn.clark@gmail.com>,
	 Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
	 linux-sparse@vger.kernel.org
Cc: Hans de Goede <hdegoede@redhat.com>, Armin Wolf <W_Armin@gmx.de>,
	 Jonathan Corbet <corbet@lwn.net>,
	Mario Limonciello <superm1@kernel.org>,
	 Luke Jones <luke@ljones.dev>, Xino Ni <nijs1@lenovo.com>,
	 Zhixin Zhang <zhangzx36@lenovo.com>,
	Mia Shao <shaohz1@lenovo.com>,
	 Mark Pearson <mpearson-lenovo@squebb.ca>,
	 "Pierre-Loup A . Griffais" <pgriffais@valvesoftware.com>,
	 "Cody T . -H . Chiu" <codyit@gmail.com>,
	 John Martens <johnfanv2@gmail.com>,
	Kurt Borja <kuurtb@gmail.com>,
	 platform-driver-x86@vger.kernel.org, linux-doc@vger.kernel.org,
	 LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v11 0/6] platform/x86: Add Lenovo WMI Gaming Series Drivers
Date: Sat, 31 May 2025 09:14:00 +0300 (EEST)	[thread overview]
Message-ID: <e98eccf5-1006-3d1b-d2fb-783637807ac7@linux.intel.com> (raw)
In-Reply-To: <CAFqHKTnp2zMTAfdYBpxestSErpsgwSf_TmkLjjU0W5HOFiC9bA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4159 bytes --]

+ Cc sparse people.

On Fri, 30 May 2025, Derek John Clark wrote:

> On Sun, May 25, 2025 at 2:42 PM Ilpo Järvinen
> <ilpo.jarvinen@linux.intel.com> wrote:
> >
> > On Mon, 26 May 2025, Ilpo Järvinen wrote:
> >
> > > On Wed, 21 May 2025, Derek J. Clark wrote:
> > >
> > > > Adds support for the Lenovo "Gaming Series" of laptop hardware that use
> > > > WMI interfaces that control various power settings. There are multiple WMI
> > > > interfaces that work in concert to provide getting and setting values as
> > > > well as validation of input. Currently only the "Gamezone", "Other
> > > > Mode", and "LENOVO_CAPABILITY_DATA_01" interfaces are implemented, but
> > > > I attempted to structure the driver so that adding the "Custom Mode",
> > > > "Lighting", and other data block interfaces would be trivial in later
> > > > patches.
> > > >
> > > > This driver attempts to standardize the exposed sysfs by mirroring the
> > > > asus-armoury driver currently under review. As such, a lot of
> > > > inspiration has been drawn from that driver.
> > > > https://lore.kernel.org/platform-driver-x86/20250319065827.53478-1-luke@ljones.dev/#t
> > > >
> > > > The drivers have been tested by me on the Lenovo Legion Go and Legion Go
> > > > S.
> > > >
> > > > Suggested-by: Mario Limonciello <superm1@kernel.org>
> > > > Reviewed-by: Armin Wolf <W_Armin@gmx.de>
> > > > Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
> > > > ---
> > > > v11:
> > > >   - Fix formmating issues.
> > >
> > > Thanks for the update, I've applied this now into the review-ilpo-next
> > > branch. BUT, this is very late in the cycle now and if there's a build
> > > issue (or LKP doesn't build test it in reasonable time), I'll have to drop
> > > this series and postpone it into the next cycle as I don't want to delay
> > > the main PR to Linus too long.
> > >
> > > But lets hope for the best, I think some depends on issues were fixed
> > > earlier (IIRC), so hopefully it works good enough now. :-)
> >
> > Hmpf, these give me a few new warnings related to this series:
> >
> > make W=1 drivers/platform/x86/
> > make C=2 drivers/platform/x86/
> 
> When I use scoped_guard the warnings go away.

Okay, not that it helps much because the implementation of guard() and 
scoped_guard() is dramatically different.

> It seems to be a
> limitation of sparse in that its not correctly identifying the guard
> will be unlocked on the return perhaps?

It's odd because we'd have those warnings all over the place if it would 
be general thing for sparse to not understand how guard() works. Maybe 
sparse people have some idea what's so special here?

To give context to sparse people, this patch triggers two false 
positives in sparse:

https://lore.kernel.org/platform-driver-x86/20250522015350.471070-6-derekjohn.clark@gmail.com/

$ make C=2 drivers/platform/x86/lenovo-wmi-gamezone.o
  CHECK   scripts/mod/empty.c
  CALL    scripts/checksyscalls.sh
  DESCEND objtool
  INSTALL libsubcmd_headers
  CHECK   drivers/platform/x86/lenovo-wmi-gamezone.c
drivers/platform/x86/lenovo-wmi-gamezone.c:155:12: warning: context 
imbalance in 'lwmi_gz_profile_get' - different lock contexts for basic 
block
drivers/platform/x86/lenovo-wmi-gamezone.c:206:12: warning: context 
imbalance in 'lwmi_gz_profile_set' - different lock contexts for basic 
block

https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/tree/drivers/platform/x86/lenovo-wmi-gamezone.c?h=review-ilpo-next#n190

(That code link is just for convinience, it's not a perma one, I'll be 
overwriting that branch eventually once the merge window is over, if not 
sooner.)

> In any case, if you're okay
> with a scoped guard here (matches both other invocations) I'll send it
> up.

I'd prefer to keep using guard() for now as this looks clearly a false 
positive from sparse, not a problem in your code.

> I also took care of the warnings for W=1.

Thanks.

> > ...I really don't know why sparse complains about the lock context
> > imbalance though, those functions use guard().

-- 
 i.

      reply	other threads:[~2025-05-31  6:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-22  1:53 [PATCH v11 0/6] platform/x86: Add Lenovo WMI Gaming Series Drivers Derek J. Clark
2025-05-22  1:53 ` [PATCH v11 1/6] platform/x86: Add lenovo-wmi-* driver Documentation Derek J. Clark
2025-05-22  1:53 ` [PATCH v11 2/6] platform/x86: Add lenovo-wmi-helpers Derek J. Clark
2025-05-22  1:53 ` [PATCH v11 3/6] platform/x86: Add Lenovo WMI Events Driver Derek J. Clark
2025-05-22  1:53 ` [PATCH v11 4/6] platform/x86: Add Lenovo Capability Data 01 WMI Driver Derek J. Clark
2025-05-22  1:53 ` [PATCH v11 5/6] platform/x86: Add Lenovo Gamezone " Derek J. Clark
2025-05-22  1:53 ` [PATCH v11 6/6] platform/x86: Add Lenovo Other Mode " Derek J. Clark
2025-05-25 21:20 ` [PATCH v11 0/6] platform/x86: Add Lenovo WMI Gaming Series Drivers Ilpo Järvinen
2025-05-25 21:41   ` Ilpo Järvinen
2025-05-25 22:31     ` Derek J. Clark
2025-05-26  9:10       ` Ilpo Järvinen
2025-05-31  3:48     ` Derek John Clark
2025-05-31  6:14       ` 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=e98eccf5-1006-3d1b-d2fb-783637807ac7@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=W_Armin@gmx.de \
    --cc=codyit@gmail.com \
    --cc=corbet@lwn.net \
    --cc=derekjohn.clark@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=johnfanv2@gmail.com \
    --cc=kuurtb@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=luke@ljones.dev \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=nijs1@lenovo.com \
    --cc=pgriffais@valvesoftware.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=shaohz1@lenovo.com \
    --cc=superm1@kernel.org \
    --cc=zhangzx36@lenovo.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;
as well as URLs for NNTP newsgroup(s).