public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Joe Perches <joe@perches.com>
Cc: Daniel Mack <daniel@zonque.org>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] ARM: pxa: fix GPIO double shifts
Date: Mon, 01 Aug 2016 00:04:27 +0200	[thread overview]
Message-ID: <87shupxy50.fsf@belgarion.home> (raw)
In-Reply-To: <1469997882.3998.136.camel@perches.com> (Joe Perches's message of "Sun, 31 Jul 2016 13:44:42 -0700")

Hi Joe,

Joe Perches <joe@perches.com> writes:
> trivially:
>> diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c
> []
>> @@ -131,15 +131,13 @@ static int corgi_should_wakeup(unsigned int resume_on_alarm)
>>  	return is_resume;
>>  }
>>  
>> -static unsigned long corgi_charger_wakeup(void)
>> +static bool corgi_charger_wakeup(void)
>>  {
>> -	unsigned long ret;
>> +	bool ret;
>>  
>> -	ret = (!gpio_get_value(CORGI_GPIO_AC_IN) << GPIO_bit(CORGI_GPIO_AC_IN))
>> -		| (!gpio_get_value(CORGI_GPIO_KEY_INT)
>> -		<< GPIO_bit(CORGI_GPIO_KEY_INT))
>> -		| (!gpio_get_value(CORGI_GPIO_WAKEUP)
>> -		<< GPIO_bit(CORGI_GPIO_WAKEUP));
>> +	ret = !gpio_get_value(CORGI_GPIO_AC_IN)
>> +		|| !gpio_get_value(CORGI_GPIO_KEY_INT)
>> +		|| !gpio_get_value(CORGI_GPIO_WAKEUP);
>
> These might be better without the automatic use of ret
>
> 	return !gpio_get_value(CORGI_GPIO_AC_IN) ||
> 	       !gpio_get_value(CORGI_GPIO_KEY_INT) ||
> 	       !gpio_get_value(CORGI_GPIO_WAKEUP);

Yeah, I thought about this when I made the patch.

I supposed it was written this way so that a printk was easier to add, that's
why I didn't change the useless variable.

I have no strong opinion about this, so if you think it's worth it I can make
the additional change.

Cheers.

--
Robert

  reply	other threads:[~2016-07-31 22:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-31 12:17 [PATCH v3] ARM: pxa: fix GPIO double shifts Robert Jarzmik
2016-07-31 20:44 ` Joe Perches
2016-07-31 22:04   ` Robert Jarzmik [this message]
2016-07-31 22:22     ` Joe Perches

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=87shupxy50.fsf@belgarion.home \
    --to=robert.jarzmik@free.fr \
    --cc=daniel@zonque.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    /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