[U-Boot] [PATCH 3/7] mpc85xx: Add inline GPIO acessor functions

Wolfgang Denk wd at denx.de
Mon Feb 21 22:56:40 CET 2011


Dear "Moffett, Kyle D",

In message <D99CA72A-BD3E-475D-B17F-1253410C6591 at boeing.com> you wrote:
>
> >> +static inline int gpio_direction_input(unsigned gpio)
> >> +{
> >> +	mpc85xx_gpio_set_in(1U << gpio);
> >> +	return 0;
> >> +}
> >
> > Why is this function not void when it cannot return any usefult return
> > code anyway?
> >
> >> +static inline int gpio_direction_output(unsigned gpio, int value)
> >> +{
> >> +	mpc85xx_gpio_set_low(1U << gpio);
> >> +	return 0;
> >> +}
> >
> > Ditto.
> 
> This is the "Linux-compatible" gpio layer that Peter Tyser was asking
> for.  I sort-of-copied most of these functions from
> arch/nios2/include/asm/gpio.h, which just does the "return 0;" in
> several functions.
> Those 2 later functions are expected to be able to return an error (for
> I2C chips and such).  As I said above, if these wrappers are
> unacceptable then I will just delete them; the only thing I use are the
> mpc85xx_gpio_*() functions.

It's not unacceptable, but maybe you add a comment to explain why
these return int.

> --Apple-Mail-2-42328377
> Content-Disposition: attachment; filename"smime.p7s"
> Content-Type: application/pkcs7-signature; name"smime.p7s"
> Content-Transfer-Encoding: base64

Do you really have to append a 120 line binary encoded signature here?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I read part of it all the way through.


More information about the U-Boot mailing list