public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>,
	Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@infradead.org>,
	ibm-acpi-devel@lists.sourceforge.net,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/3] platform/x86: thinkpad_acpi: Make logic straight in hotkey_exit()
Date: Tue, 09 May 2017 20:28:51 +0300	[thread overview]
Message-ID: <1494350931.30052.92.camel@linux.intel.com> (raw)
In-Reply-To: <20170509170206.GB19242@khazad-dum.debian.net>

On Tue, 2017-05-09 at 14:02 -0300, Henrique de Moraes Holschuh wrote:

Thanks for review, my comments below.

> On Tue, 09 May 2017, Andy Shevchenko wrote:
> > The commit 4be73005e4dc
> > 
> > 	("thinkpad-acpi: remove uneeded tp_features.hotkey tests in
> > hotkey_exit")
> > 
> > adds a complex logic behind hotkey status check in a way
> > it started mixing logical operations with bitwise ones.
> > 
> > Refactor the code to make it straight and slightly clearer.
> 
> Eh, I find this actually less clear, given the comment that was in the
> old code, which you deleted.

For me doing 'bitwise or' on negative return code and boolean looks
weird...

> 
> Please keep the important part of the comment at the very least.

...that's why comment has been added I suppose, and my patch makes it
not needed.

Though, I better just drop the change completely, I didn't pay attention
if compiler warns about current implementation, I think it should.

> 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  drivers/platform/x86/thinkpad_acpi.c | 9 ++++-----
> >  1 file changed, 4 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/platform/x86/thinkpad_acpi.c
> > b/drivers/platform/x86/thinkpad_acpi.c
> > index 7b6cb0c69b02..7740b5e1b998 100644
> > --- a/drivers/platform/x86/thinkpad_acpi.c
> > +++ b/drivers/platform/x86/thinkpad_acpi.c
> > @@ -3090,6 +3090,8 @@ static void tpacpi_send_radiosw_update(void)
> >  
> >  static void hotkey_exit(void)
> >  {
> > +	int res;
> > +
> >  #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
> >  	mutex_lock(&hotkey_mutex);
> >  	hotkey_poll_stop_sync();
> > @@ -3101,11 +3103,8 @@ static void hotkey_exit(void)
> >  
> >  	dbg_printk(TPACPI_DBG_EXIT | TPACPI_DBG_HKEY,
> >  		   "restoring original HKEY status and mask\n");
> > -	/* yes, there is a bitwise or below, we want the
> > -	 * functions to be called even if one of them fail */
> > -	if (((tp_features.hotkey_mask &&
> > -	      hotkey_mask_set(hotkey_orig_mask)) |
> > -	     hotkey_status_set(false)) != 0)
> > +	res = tp_features.hotkey_mask ?
> > hotkey_mask_set(hotkey_orig_mask) : 0;
> > +	if (hotkey_status_set(false) || res)
> >  		pr_err("failed to restore hot key mask "
> >  		       "to BIOS defaults\n");
> >  }
> 
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

      reply	other threads:[~2017-05-09 17:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-09 14:17 [PATCH v1 1/3] platform/x86: thinkpad_acpi: Make logic straight in hotkey_exit() Andy Shevchenko
2017-05-09 14:17 ` [PATCH v1 2/3] platform/x86: thinkpad_acpi: Join string literals back Andy Shevchenko
2017-05-09 17:10   ` Henrique de Moraes Holschuh
2017-05-09 17:33     ` Andy Shevchenko
2017-05-10  0:24       ` Henrique de Moraes Holschuh
2017-05-10 10:51         ` Andy Shevchenko
2017-05-10 13:21           ` Henrique de Moraes Holschuh
2017-05-09 14:17 ` [PATCH v1 3/3] platform/x86: thinkpad_acpi: Add a comment about 0 in module_param_call() Andy Shevchenko
2017-05-09 17:03   ` Henrique de Moraes Holschuh
2017-05-09 17:02 ` [PATCH v1 1/3] platform/x86: thinkpad_acpi: Make logic straight in hotkey_exit() Henrique de Moraes Holschuh
2017-05-09 17:28   ` Andy Shevchenko [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=1494350931.30052.92.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=hmh@hmh.eng.br \
    --cc=ibm-acpi-devel@lists.sourceforge.net \
    --cc=ibm-acpi@hmh.eng.br \
    --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