From: "Magnus Damm" <magnus.damm@gmail.com>
To: "David Brownell" <david-b@pacbell.net>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [patch 2.6.27-rc7] gpiolib: request/free hooks
Date: Mon, 29 Sep 2008 12:48:02 +0900 [thread overview]
Message-ID: <aec7e5c30809282048x3d9a201j12303091e9d93a49@mail.gmail.com> (raw)
In-Reply-To: <200809271129.07241.david-b@pacbell.net>
On Sun, Sep 28, 2008 at 3:29 AM, David Brownell <david-b@pacbell.net> wrote:
> On Saturday 27 September 2008, Magnus Damm wrote:
>>
>> Looking good. I'm currently hacking on some pinmuxed gpio code for
>> SuperH, and I'd like to use these request/free callbacks to select
>> proper pinmux state.
>
> I'm not so keen on that particular overloading, but I can
> understand why it might be wanted on systems which have a
> happy one-to-one mapping between GPIOs and pins.
Hm, sounds like you prefer to keep pinmuxing and GPIO code separated?
> If you do that, be ready to provide a pinmux-only interface
> at some point when this "piggybacking" breaks something...
In the SuperH case GPIO pin direction selection is done in the same
way as selecting pin function. So in and out directions can be seen as
two pin functions. And since we want to support GPIO pin direction we
may as well support setting pin functions as well.
But maybe there are better ways to integrate it, I'm not sure.
>> > --- a/drivers/gpio/gpiolib.c
>> > +++ b/drivers/gpio/gpiolib.c
>> > @@ -781,6 +785,7 @@ EXPORT_SYMBOL_GPL(gpiochip_remove);
>> > int gpio_request(unsigned gpio, const char *label)
>> > ...
>>
>> The code above doesn't catch double gpio_request() user calls
>> properly. Or rather, the user will receive an error but the
>> chip->request() callback may get called twice.
>>
>> What about modifying the gpiolib code to handle that? I think that
>> sounds like a better idea than cover ing that case in the chip code...
>
> Yeah. Better to test-and-set the flag and then request, and backout
> if it fails, than the other way. Just who wrote that crap in the
> first place? Sigh. (Notice it's done that way already in the code
> path handling implicit requesting ... )
Sounds good.
> I'll send an updated patch along soonish.
Thank you!
/ magnus
next prev parent reply other threads:[~2008-09-29 3:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-24 22:08 David Brownell
2008-09-27 15:00 ` Magnus Damm
2008-09-27 18:29 ` David Brownell
2008-09-29 3:48 ` Magnus Damm [this message]
2008-09-29 17:21 ` David Brownell
2008-10-06 4:57 ` David Brownell
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=aec7e5c30809282048x3d9a201j12303091e9d93a49@mail.gmail.com \
--to=magnus.damm@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david-b@pacbell.net \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®