From: nikai@nikai.net (Nicolas Kaiser)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm: nomadik: avoid assigning u32 to bool
Date: Sun, 3 Apr 2011 12:26:11 +0200 [thread overview]
Message-ID: <20110403122611.4cca78b9@absol.kitzblitz> (raw)
In-Reply-To: <BANLkTinujPcSq86wjue+SGw5ZMiiLRaT_A@mail.gmail.com>
* Rabin Vincent <rabin@rab.in>:
> On Sat, Apr 2, 2011 at 03:21, Nicolas Kaiser <nikai@nikai.net> wrote:
> > Avoid assigning u32 to the bool 'enabled'.
> >
> > Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
> > ---
> > ?arch/arm/plat-nomadik/gpio.c | ? ?2 +-
> > ?1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/arch/arm/plat-nomadik/gpio.c b/arch/arm/plat-nomadik/gpio.c
> > index f49748e..8b722f7 100644
> > --- a/arch/arm/plat-nomadik/gpio.c
> > +++ b/arch/arm/plat-nomadik/gpio.c
> > @@ -636,7 +636,7 @@ static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type)
> > ? ? ? ?if (type & IRQ_TYPE_LEVEL_LOW)
> > ? ? ? ? ? ? ? ?return -EINVAL;
> >
> > - ? ? ? enabled = nmk_chip->enabled & bitmask;
> > + ? ? ? enabled = !!(nmk_chip->enabled & bitmask);
>
> Why? There are dozens of places in the kernel where this done, the code
> generated should be the same, and it's pretty obvious what is being done
> as it is.
Primarily because we were asked to avoid casts to bool even if
they are safe.
https://lkml.org/lkml/2011/4/1/255
Besides, many of the places I found that do 'bool a = b & c;'
actually do 'bool a = b & 1;'.
Best regards,
Nicolas Kaiser
next prev parent reply other threads:[~2011-04-03 10:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-01 21:51 [PATCH] arm: nomadik: avoid assigning u32 to bool Nicolas Kaiser
2011-04-02 21:02 ` Linus Walleij
2011-04-02 21:19 ` Alessandro Rubini
2011-04-03 3:58 ` Rabin Vincent
2011-04-03 10:26 ` Nicolas Kaiser [this message]
2011-04-03 10:52 ` Alessandro Rubini
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=20110403122611.4cca78b9@absol.kitzblitz \
--to=nikai@nikai.net \
--cc=linux-arm-kernel@lists.infradead.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