public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Jiri Slaby <jirislaby@gmail.com>, Michael Buesch <mb@bu3sch.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	mchehab@infradead.org,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Marcel Holtmann <marcel@holtmann.org>
Subject: Re: [PATCH v3] Add bt8xxgpio driver
Date: Thu, 10 Jul 2008 13:02:12 -0700	[thread overview]
Message-ID: <200807101302.12765.david-b@pacbell.net> (raw)
In-Reply-To: <487651CA.6030405@gmail.com>

On Thursday 10 July 2008, Jiri Slaby wrote:
> > --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> > +++ linux-next/drivers/gpio/bt8xxgpio.c	2008-07-10 19:05:56.000000000 +0200
> > @@ -0,0 +1,348 @@
> [...]
> > +static int bt8xxgpio_gpio_direction_input(struct gpio_chip *gpio, unsigned nr)
> > +{
> > +	struct bt8xxgpio *bg = container_of(gpio, struct bt8xxgpio, gpio);
> > +	unsigned long flags;
> > +	u32 outen, data;
> > +
> > +	spin_lock_irqsave(&bg->lock, flags);
> 
> Why all those irq variants? I can't see interrupts anywhere. May gpio call this 
> from irq?

Not that routine (see Documentation/gpio.txt where
that's specified) ... but other using the same lock.

When setting GPIO direction, spin_lock_irq() style
calls are appropriate (but this isn't wrong).

The gpio_{get,set}_value() accessors may be called
from IRQ context, so they need to save/restor the
IRQ flags.


> some flushing of posted values here?

See Documentation/gpio.txt:

+ Note that these operations include I/O barriers on platforms
+ which need to use them; drivers don't need to add them explicitly.

That's the key thing:  drivers using I/O calls should
not need to insert bus or platform specific calls to
make sure the calls take effect.


Also:

> +	return !!(val & (1 << nr));

GPIO values are zero/nonzero, not zero/one.  So the "!!"
can be removed.

- Dave

  parent reply	other threads:[~2008-07-10 20:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-10 17:14 [PATCH v3] Add bt8xxgpio driver Michael Buesch
2008-07-10 18:15 ` Jiri Slaby
2008-07-10 18:44   ` Michael Buesch
2008-07-10 20:02   ` David Brownell [this message]
2008-07-11 12:53     ` Michael Buesch
2008-07-10 19:02 ` Mauro Carvalho Chehab
2008-07-10 19:12   ` Michael Buesch
2008-07-10 19:33     ` Mauro Carvalho Chehab
2008-07-11 13:00       ` Michael Buesch

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=200807101302.12765.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=akpm@linux-foundation.org \
    --cc=jirislaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=mb@bu3sch.de \
    --cc=mchehab@infradead.org \
    --cc=sfr@canb.auug.org.au \
    /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