From: "Barbier, Renaud" <renaud.barbier@abaco.com>
To: "barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: gpio generic driver
Date: Thu, 23 Jul 2020 19:51:15 +0000 [thread overview]
Message-ID: <MN2PR16MB313535B92C50776EC02EBD6191760@MN2PR16MB3135.namprd16.prod.outlook.com> (raw)
Question regarding the function below:
static int bgpio_get(struct gpio_chip *gc, unsigned int gpio)
{
struct bgpio_chip *bgc = to_bgpio_chip(gc);
~ return bgc->read_reg(bgc->reg_dat) & bgc->pin2mask(bgc, gpio);
}
This returns the value from the register i.e the value as in 0x01000000 for bit 3BE or 28LE. This is what I see using the drivers/gpio/gpio-mpc8xxx.c driver.
Is it not supposed to return just 0 or 1?
Linux has
return !!(gc->read_reg(gc->reg_dat) & bgpio_line2mask(gc, gpio));
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2020-07-23 19:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-23 19:51 Barbier, Renaud [this message]
2020-07-24 8:20 ` Lucas Stach
2020-07-24 8:40 ` Barbier, Renaud
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=MN2PR16MB313535B92C50776EC02EBD6191760@MN2PR16MB3135.namprd16.prod.outlook.com \
--to=renaud.barbier@abaco.com \
--cc=barebox@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