[U-Boot] [PATCH 1/2] GPIO: Extend the cmd_gpio API by gpio_{from, to}_string()

Mike Frysinger vapier at gentoo.org
Fri May 18 04:53:56 CEST 2012


On Tuesday 15 May 2012 01:53:10 Marek Vasut wrote:
> Dear Mike Frysinger,
> > On Monday 14 May 2012 14:25:14 Marek Vasut wrote:
> > > Dear Mike Frysinger,
> > > > On Monday 14 May 2012 07:31:35 Marek Vasut wrote:
> > > > > Dear Mike Frysinger,
> > > > > > On Tuesday 01 May 2012 16:50:14 Marek Vasut wrote:
> > > > > > > The gpio_from_string() call shall parse the incoming GPIO name
> > > > > > > taken from the command line and return the GPIO number used
> > > > > > > within U-Boot or return -1 on error.
> > > > > > 
> > > > > > i.e. the already existing name_to_gpio() func
> > > > > 
> > > > > You mean blackfin specific macro crap? Let's actually drop that and
> > > > > switch over to this one. That was my intention from start.
> > > > 
> > > > don't spout this crap.  try reading the actual history on the lists
> > > > for the background on the naming, and then try actually grepping the
> > > > tree to see that multiple targets implement it.
> > > 
> > > Can you point me to something? This is the result of git grep, so I
> > > odn't see it used at all.
> > > 
> > > arch/blackfin/include/asm/gpio.h:static inline int name_to_gpio(const
> > > char *name)
> > > arch/blackfin/include/asm/gpio.h:#define name_to_gpio(n)
> > > name_to_gpio(n) common/cmd_gpio.c:#ifndef name_to_gpio
> > > common/cmd_gpio.c:#define name_to_gpio(name) simple_strtoul(name, NULL,
> > > 10) common/cmd_gpio.c:      return name_to_gpio(name);
> > 
> > seems like the patches posted and i've been through haven't been merged.
> 
> Well ... that sucks. So there was some improvement in that direction
> already? Why werent those patches merged, can you repost?

i wasn't the one posting them, just helping review :)

> > gpio_status() is the only one to gain wider support.
> 
> What gpio_status()?

grep the tree for it :p

it let's you do "gpio status" and see what gpios have been allocated by 
different devices.  just a debugging tool, similar to like /proc/iomem.

> > > > > > > The gpio_to_string() on the other hand allows nicer reporting
> > > > > > > of GPIO name in the output of cmd_gpio.
> > > > > > 
> > > > > > i don't see the value in this.  we already have the string name
> > > > > > from the
> > > > > > 
> > > > > > user, so all you've implemented is:
> > > > > > 	gpio_to_string(gpio_from_string(argv[]))
> > > > > > 
> > > > > > at which point, argv[] works fine.
> > > > > 
> > > > > This allows for taking multiple different inputs, while reporting
> > > > > one unified output.
> > > > 
> > > > sounds like unnecessary bloat
> > > 
> > > Now you're spouting crap, it makes sense to be able to report the name
> > > consistently.
> > 
> > except the output is for user's eyes only and doesn't make a lick of a
> > difference to runtime behavior.  either they know the GPIO # (because
> > they looked it up), or they're using the friendly name (which came from
> > a datasheet).  in either case, things continue to work regardless of the
> > input. the "value add" here doesn't justify the overhead imo.
> 
> Well how often do you use cmd_gpio in a timing-critical aplication?

not sure how that's relevant.  my complaint is with code size expansion for 
what is, imo, not terribly useful.  maybe Blackfin parts are different, but the 
GPIO use has been fairly straight forward for people.

if you were to implement gpio_to_name like the existing name_to_gpio defines, i 
wouldn't complain as anyone choosing to not implement wouldn't see a code size 
difference.
-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/20120517/9f1b28b3/attachment.pgp>


More information about the U-Boot mailing list