mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Alexander Aring <alex.aring@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/4] gpiolib: make gpiolib command more verbose
Date: Mon, 11 Nov 2013 09:07:27 +0100	[thread overview]
Message-ID: <20131111080727.GD24559@pengutronix.de> (raw)
In-Reply-To: <20131111013019.GA16967@x61s.Speedport_W_921V_1_24_000>

On Mon, Nov 11, 2013 at 02:30:20AM +0100, Alexander Aring wrote:
> Hi Sebastian,
> 
> On Sat, Nov 09, 2013 at 02:24:08PM +0100, Sebastian Hesselbarth wrote:
> > This adds some more printf information to gpiolib command, like the
> > gpiochip handling a specific gpio. Also, current direction and value
> > of the gpio are printed, if the gpiochip provides the corresponding
> > callbacks.
> > 
> > Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> > ---
> > Cc: barebox@lists.infradead.org
> > ---
> >  drivers/gpio/gpiolib.c | 24 +++++++++++++++++++++---
> >  1 file changed, 21 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> > index ca6e8ad..c12ebe6 100644
> > --- a/drivers/gpio/gpiolib.c
> > +++ b/drivers/gpio/gpiolib.c
> > @@ -228,16 +228,34 @@ static int do_gpiolib(int argc, char *argv[])
> >  	int i;
> >  
> >  	printf("gpiolib: gpio lists\n");
> > -	printf("%*crequested  label\n", 11, ' ');
> >  
> >  	for (i = 0; i < ARCH_NR_GPIOS; i++) {
> >  		struct gpio_info *gi = &gpio_desc[i];
> > +		int val = -1, dir = -1;
> >  
> >  		if (!gi->chip)
> >  			continue;
> >  
> > -		printf("gpio %*d: %*s  %s\n", 4,
> > -			i, 9, gi->requested ? "true" : "false",
> > +		/* print chip information and header on first gpio */
> > +		if (gi->chip->base == i) {
> > +			printf("\ngpios %u-%u, chip %s:\n",
> > +				gi->chip->base,
> > +				gi->chip->base + gi->chip->ngpio,
> 
> I think this should be "gi->chip->base + gi->chip->ngpio - 1", because
> we starting at zero on base.

Indeed. Otherwise I get the following for my 32bit gpio bank:

gpios 0-31, chip 209c000.gpio:
             dir val requested  label
  gpio    0: unk  lo     false  
  gpio    1: unk  lo     false  
...

Fixed this while applying.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

  reply	other threads:[~2013-11-11  8:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-09 13:24 [PATCH 0/4] gpiolib debug and led trigger fixes Sebastian Hesselbarth
2013-11-09 13:24 ` [PATCH 1/4] led: trigger: disable LEDs with trigger before installing it Sebastian Hesselbarth
2013-11-09 13:24 ` [PATCH 2/4] gpiolib: add get_direction callback Sebastian Hesselbarth
2013-11-09 13:24 ` [PATCH 3/4] gpiolib: make gpiolib command more verbose Sebastian Hesselbarth
2013-11-11  1:30   ` Alexander Aring
2013-11-11  8:07     ` Sascha Hauer [this message]
2013-11-11  8:12       ` Alexander Aring
2013-11-09 13:24 ` [PATCH 4/4] gpio: dw: add get_direction callback Sebastian Hesselbarth

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=20131111080727.GD24559@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=alex.aring@gmail.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