public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Domenico Andreoli <cavokz@gmail.com>
To: Michael Buesch <mb@bu3sch.de>
Cc: David Brownell <david-b@pacbell.net>,
	video4linux-list@redhat.com,
	Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: Re: [PATCH v3] Add bt8xxgpio driver
Date: Mon, 14 Jul 2008 17:25:50 +0200	[thread overview]
Message-ID: <20080714152550.GA32470@ska.dandreoli.com> (raw)
In-Reply-To: <200807141558.29582.mb@bu3sch.de>

On Mon, Jul 14, 2008 at 03:58:29PM +0200, Michael Buesch wrote:
> On Monday 14 July 2008 09:27:33 Domenico Andreoli wrote:
> > +static u32 nr_to_mask(struct bttv_gpiolib_device *dev, unsigned nr)
> > +{
> > +	u32 io_mask = dev->in_mask | dev->out_mask;
> > +	int shift = 0;
> > +
> > +	while(io_mask && nr) {
> > +		nr -= io_mask & 1;
> > +		io_mask >>= 1;
> > +		shift++;
> > +	}
> > +
> > +	return 1 << shift;
> > +}
> 
> This loop is really really weird.
> What the hell are you doing here?
> You ususally convert GPIO numbers to masks by doing (1 << nr), only.

gpiolib does not allow holes in the number space of gpios. once you
set chip.ngpio, you get a contiguous slice.

should the board have some of its gpio connected to something private,
they are not to be exported to gpiolib and to the user.

indeed once, as a user, I know to have a board which has n inputs and
m output and z in/out, that's all, I do not want to know how many GPIOs
actually are on the board and how are connected.

nr_to_mask() hides those holes to the user, it maps a pin iff it is
available for gpiolib fiddling.

thanks,
Domenico

-----[ Domenico Andreoli, aka cavok
 --[ http://www.dandreoli.com/gpgkey.asc
   ---[ 3A0F 2F80 F79C 678A 8936  4FEE 0677 9033 A20E BC50

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

  parent reply	other threads:[~2008-07-14 15:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200807101914.10174.mb@bu3sch.de>
     [not found] ` <20080710160258.4ddb5c61@gaivota>
2008-07-13  0:42   ` [PATCH v3] Add bt8xxgpio driver Domenico Andreoli
     [not found]     ` <200807131215.12082.mb@bu3sch.de>
2008-07-13 15:43       ` Domenico Andreoli
     [not found]         ` <200807131808.35599.mb@bu3sch.de>
2008-07-13 16:39           ` Domenico Andreoli
2008-07-15  8:46             ` Trent Piepho
     [not found]         ` <200807131300.35126.david-b@pacbell.net>
2008-07-14  5:25           ` Domenico Andreoli
     [not found]             ` <200807132259.54360.david-b@pacbell.net>
2008-07-14  7:27               ` Domenico Andreoli
     [not found]                 ` <200807141558.29582.mb@bu3sch.de>
2008-07-14 15:25                   ` Domenico Andreoli [this message]
     [not found]                     ` <200807140926.28592.david-b@pacbell.net>
2008-07-14 17:08                       ` Domenico Andreoli
     [not found]                     ` <200807141951.39810.mb@bu3sch.de>
2008-07-14 19:21                       ` Domenico Andreoli

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=20080714152550.GA32470@ska.dandreoli.com \
    --to=cavokz@gmail.com \
    --cc=david-b@pacbell.net \
    --cc=mb@bu3sch.de \
    --cc=mchehab@infradead.org \
    --cc=video4linux-list@redhat.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