From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC] gpio command: return value on write, additional actions
Date: Tue, 5 Jul 2011 13:44:15 -0400 [thread overview]
Message-ID: <201107051344.15873.vapier@gentoo.org> (raw)
In-Reply-To: <1309885156.15056.45.camel@ws-apr.office.loc>
On Tuesday, July 05, 2011 12:59:16 Andreas Pretzsch wrote:
> As of today (2011.06), the generic gpio command (common/cmd_gpio.c)
> gpio <input|set|clear|toggle> <port><pin>
> - input/set/clear/toggle the specified pin (e.g. PF10)
> always returns the value read or set.
>
> While this is sensible for read (input) and maybe (questionable) for
> toggle, I don't see an usage for write (set/clear).
the trouble with toggle is that there's no way to get the value without
changing it to the input. we'd have to add another field that has no
unintentional side effects like "gpio value". then we could change all the
others to return 0/1 based on whether they succeeded, not based on the level
of the gpio pin.
> Also, this leads to unexpected side effects with complex constructs,
> e.g. consider this environment:
> setA=gpio set PF1
> setB=gpio clear PF2
> setAB_separate=env run setA ; env run setB
> setAB_concatenated=env run setA setB
> setBA_concatenated=env run setB setA
>
> While executing "setAB_separate" and "setBA_concatenated" work as
> expected, "setAB_concatenated" will only run setA, but not setB, as setA
> "failed" (ret=1). [1]
> The same would apply to e.g. && constructs.
ive never used the shell in u-boot, but couldnt the first logic be:
setA=gpio set PF1 || :
setB=gpio clear PF2 || :
> As it works this way in the release and hence the behaviour is
> essentially fixed, changing the return value is probably not an option.
not really. poor behavior can be adjusted.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110705/f889a418/attachment.pgp
next prev parent reply other threads:[~2011-07-05 17:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-05 16:59 [U-Boot] [RFC] gpio command: return value on write, additional actions Andreas Pretzsch
2011-07-05 17:44 ` Mike Frysinger [this message]
2011-07-05 19:15 ` Andreas Pretzsch
2011-07-05 19:33 ` Mike Frysinger
2011-07-06 8:33 ` Detlev Zundel
2011-07-06 10:36 ` Wolfgang Denk
2011-07-07 10:15 ` Detlev Zundel
2011-07-20 18:22 ` Andreas Pretzsch
2011-07-14 20:07 ` Mike Frysinger
2011-07-15 7:39 ` Detlev Zundel
2011-07-18 18:08 ` Mike Frysinger
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=201107051344.15873.vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=u-boot@lists.denx.de \
/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