mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Barbier, Renaud" <renaud.barbier@abaco.com>
To: Lucas Stach <l.stach@pengutronix.de>,
	"barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: RE: gpio generic driver
Date: Fri, 24 Jul 2020 08:40:07 +0000	[thread overview]
Message-ID: <MN2PR16MB313567A878F515D9A7ECF86991770@MN2PR16MB3135.namprd16.prod.outlook.com> (raw)
In-Reply-To: <795d7b96dea1b9f6ab60020f9725c185d9f0822c.camel@pengutronix.de>

Of course. Preparing a patch

> -----Original Message-----
> From: Lucas Stach [mailto:l.stach@pengutronix.de]
> Sent: 24 July 2020 09:20
> To: Barbier, Renaud <renaud.barbier@abaco.com>;
> barebox@lists.infradead.org
> Subject: Re: gpio generic driver
> 
> 
> 
> [**EXTERNAL SOURCE**]:Please verify the source before clicking link or
> opening attachment.
> 
> Am Donnerstag, den 23.07.2020, 19:51 +0000 schrieb Barbier, Renaud:
> > 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));
> 
> This shouldn't make a difference when the return value is just used in
> a condition, but it may confuse other uses which expect the normalized
> 1/0 form.
> 
> Care to send a patch to change this to the more correct Linux version?
> 
> Regards,
> Lucas

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2020-07-24  8:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 19:51 Barbier, Renaud
2020-07-24  8:20 ` Lucas Stach
2020-07-24  8:40   ` Barbier, Renaud [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=MN2PR16MB313567A878F515D9A7ECF86991770@MN2PR16MB3135.namprd16.prod.outlook.com \
    --to=renaud.barbier@abaco.com \
    --cc=barebox@lists.infradead.org \
    --cc=l.stach@pengutronix.de \
    /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