From: David Brownell <david-b@pacbell.net>
To: Kim Kyuwon <q1.kim@samsung.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>,
Greg KH <greg@kroah.com>, Kay Sievers <kay.sievers@vrfy.org>,
kyungmin.park@samsung.com, chammoru@gmail.com
Subject: Re: Suggestion on GPIO sysfs interface (gpio_export)
Date: Mon, 20 Apr 2009 09:52:34 -0700 [thread overview]
Message-ID: <200904200952.34656.david-b@pacbell.net> (raw)
In-Reply-To: <49EC06A6.4040506@samsung.com>
On Sunday 19 April 2009, Kim Kyuwon wrote:
> Can I ask you opinion about this idea?
First issue: labels aren't required to be unique, so
there's a certain level of unpredictability you're
introducing. Exports using this new flag would fail
sometimes depending on what *other* exports did.
(That's part of the reason "gpio%d" names got used
in the first place!)
Another layer of unpredicatability comes from the
way those strings are only available given debugfs.
Second:
> -extern int gpio_export(unsigned gpio, bool direction_may_change);
> +extern int gpio_export(unsigned gpio, bool direction_may_change,
> + bool label_may_show);
It's generally confusing to add more parameters of the same type
like that; there's no fundamental reason for people to remember
which one means what, and the compiler can't help at all when (!)
they get confused.
Have you thought much about other options? Like for example
adding a new call. With each MMC card slot, for one example,
there would often be two GPIOs: card_detect, write_protect.
With two such slots, the "label" wouldn't be much help unless
it were specifically made unique.
Instead of exporting the GPIOs in a "flat" namespace, maybe
something like
gpio_export_dev(struct device *dev, const char *tag,
unsigned gpio, bool direction_may_change);
would be more useful. It could gpio_export() the standard
way, then set up a symlink using "tag" to set up a symlink
from /sys/.../dev/tag to /sys/class/gpio/gpioN node. Easy
to see how that would work for those MMC examples.
I can imagine there would be times when the GPIO doesn't
have a logical coupling to any device, of course. So maybe
that doesn't address your particular issue.
- Dave
next prev parent reply other threads:[~2009-04-20 16:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-20 5:22 Suggestion on GPIO sysfs interface (gpio_export) Kim Kyuwon
2009-04-20 16:52 ` David Brownell [this message]
2009-04-22 2:09 ` Kim Kyuwon
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=200904200952.34656.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=chammoru@gmail.com \
--cc=g.liakhovetski@pengutronix.de \
--cc=greg@kroah.com \
--cc=kay.sievers@vrfy.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=q1.kim@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.