public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-kernel@vger.kernel.org,
	Grant Likely <grant.likely@secretlab.ca>,
	Peter Tyser <ptyser@xes-inc.com>,
	Jean Delvare <khali@linux-fr.org>
Subject: Re: [PATCH] gpio: gpio-ich: fix ichx_gpio_check_available() return what callers expect
Date: Thu, 7 Mar 2013 08:35:41 +0200	[thread overview]
Message-ID: <20130307063541.GS31790@intel.com> (raw)
In-Reply-To: <CACRpkdb21s+XDc+Ad0RBDT+KQ2C7CbK-rPO3GwEU4mOzpjj+TQ@mail.gmail.com>

On Thu, Mar 07, 2013 at 04:23:56AM +0100, Linus Walleij wrote:
> Hi Mika,
> 
> On Wed, Feb 27, 2013 at 4:25 PM, Mika Westerberg
> <mika.westerberg@linux.intel.com> wrote:
> 
> > -static int ichx_gpio_check_available(struct gpio_chip *gpio, unsigned nr)
> > +static bool ichx_gpio_check_available(struct gpio_chip *gpio, unsigned nr)
> >  {
> > -       return (ichx_priv.use_gpio & (1 << (nr / 32))) ? 0 : -ENXIO;
> > +       return ichx_priv.use_gpio & (1 << (nr / 32));
> >  }
> 
> Strictly speaking what you're returning there is not a bool.
> Shouldn't it be:
> 
> return !!(ichx_priv.use_gpio & (1 << (nr / 32)));
> 
> ?

A C reference manual says something like: When converting any scalar value
to type _Bool, all nonzero values are converted to 1, while zero values are
converted to 0 (1 being canonical value for true).

However, I'm happy to send a patch changing this if you like so (Grant
applied the patch already).

      reply	other threads:[~2013-03-07  6:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-27 15:25 [PATCH] gpio: gpio-ich: fix ichx_gpio_check_available() return what callers expect Mika Westerberg
2013-03-02  9:18 ` Grant Likely
2013-03-03 13:49   ` Jean Delvare
2013-03-07  3:23 ` Linus Walleij
2013-03-07  6:35   ` Mika Westerberg [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=20130307063541.GS31790@intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=grant.likely@secretlab.ca \
    --cc=khali@linux-fr.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ptyser@xes-inc.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