All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Woithe <jwoithe@just42.net>
To: Micha?? K??pie?? <kernel@kempniu.pl>
Cc: Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@infradead.org>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 5/8] platform/x86: fujitsu-laptop: track the last instantiated FUJ02E3 ACPI device
Date: Wed, 24 May 2017 09:23:17 +0930	[thread overview]
Message-ID: <20170523235317.GE11878@marvin.atrad.com.au> (raw)
In-Reply-To: <20170523214706.GA3151@kmp-mobile.hq.kempniu.pl>

On Tue, May 23, 2017 at 11:47:06PM +0200, Micha?? K??pie?? wrote:
> > On Fri, May 19, 2017 at 09:44:45AM +0200, Micha?? K??pie?? wrote:
> > > It is easier to simply store a module-wide
> > > pointer to the last (most likely only) FUJ02E3 ACPI device found, make
> > > the aforementioned API use it and cover our bases by warning the user if
> > > firmware exposes multiple FUJ02E3 ACPI devices.
> > > :
> > > @@ -788,6 +789,9 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device)
> > >  	if (!priv)
> > >  		return -ENOMEM;
> > >  
> > > +	WARN_ONCE(fext, "More than one FUJ02E3 ACPI device was found.  Driver may not work as intended.");
> > > +	fext = device;
> > > +
> > >  	fujitsu_laptop = priv;
> > >  	fujitsu_laptop->acpi_handle = device->handle;
> > >  	sprintf(acpi_device_name(device), "%s",
> > 
> > I thought WARN_ONCE() printed the warning when it was encountered for the
> > first time and then suppressed it on all other occasions.
> 
> Correct.
> 
> > If this is true
> > then we'll get the warning even when there is only one FUJ02E3 in the
> > system.  Am I missing something?
> 
> Probably the fact that the first argument of the macro is a conditional
> expression ...

Ah (having now had an opportunity to look at the source of WARN_ONCE()),
it's tested within WARN_ONCE.

> ("fext" is functionally equivalent to "fext != NULL" in this case).

Indeed, by virtue of the test done in WARN_ONCE().  Ok, that makes sense.

Regards
  jonathan

  reply	other threads:[~2017-05-23 23:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-19  7:44 [PATCH v2 0/8] fujitsu-laptop: use device-specific data instead of module-wide globals Michał Kępień
2017-05-19  7:44 ` [PATCH v2 1/8] platform/x86: fujitsu-laptop: distinguish current uses of device-specific data Michał Kępień
2017-05-19  7:44 ` [PATCH v2 2/8] platform/x86: fujitsu-laptop: allocate struct fujitsu_bl in acpi_fujitsu_bl_add() Michał Kępień
2017-05-19  7:44 ` [PATCH v2 3/8] platform/x86: fujitsu-laptop: use device-specific data in backlight code Michał Kępień
2017-05-19  7:44 ` [PATCH v2 4/8] platform/x86: fujitsu-laptop: allocate struct fujitsu_laptop in acpi_fujitsu_laptop_add() Michał Kępień
2017-05-19  7:44 ` [PATCH v2 5/8] platform/x86: fujitsu-laptop: track the last instantiated FUJ02E3 ACPI device Michał Kępień
2017-05-21 23:18   ` Jonathan Woithe
2017-05-23 21:47     ` Michał Kępień
2017-05-23 23:53       ` Jonathan Woithe [this message]
2017-05-19  7:44 ` [PATCH v2 6/8] platform/x86: fujitsu-laptop: explicitly pass ACPI device to call_fext_func() Michał Kępień
2017-05-19  7:44 ` [PATCH v2 7/8] platform/x86: fujitsu-laptop: use device-specific data in LED-related code Michał Kępień
2017-05-19  7:44 ` [PATCH v2 8/8] platform/x86: fujitsu-laptop: use device-specific data in remaining module code Michał Kępień
2017-05-21 23:23 ` [PATCH v2 0/8] fujitsu-laptop: use device-specific data instead of module-wide globals Jonathan Woithe
2017-05-24  0:00   ` Jonathan Woithe
2017-06-03 19:06     ` Darren Hart

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=20170523235317.GE11878@marvin.atrad.com.au \
    --to=jwoithe@just42.net \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=kernel@kempniu.pl \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.