[PATCH 1/4] of_gpio: Return GPIO flags from of_get_gpio()A

Trent Piepho tpiepho at freescale.com
Thu Oct 30 13:21:24 EST 2008


On Tue, 28 Oct 2008, Anton Vorontsov wrote:
> On Fri, Oct 24, 2008 at 04:08:58PM -0700, Trent Piepho wrote:
>> + * @flags:	if non-NUll flags are returned here
>
> NULL, not NUll.

Thanks, fixed.

>> +			 const void *gpio_spec, unsigned int *flags)
>
> Why you made it unsigned int? In my original patch, I used
> named enum, which is self-documenting type.

I started writing this patch before you posted yours, and I didn't think of
the enum.  But you have a good point so I'll switch to an enum.

>> + * Flags as returned by OF GPIO chip's xlate function.
>> + * These do not need to be the same as the flags in the GPIO specifier in the
>> + * OF device tree, but it's convenient if they are.  The mm chip OF GPIO
>> + * driver works this way.
>
> This is not of_mm_gpio_chip specific.

of_mm_gpio_chip was just an example of a driver that uses the same flag format
for Linux and the OF binding.  I'll clarify the comment.

WRT changing the interface, Linux doesn't provide a stable kernel API. 
Functions that have been around far longer than of_get_gpio() and have far
more users have changed.  Yes, it is slightly annoying now.  But providing
backward compatibility for every single interface change will produce a
bloated and redundant API that will be around forever.

> Can you repost a fixed version with my Ack and Cc: Andrew Morton,
> Benjamin Herrenschmidt?
>
> I think this change should go into the 2.6.28, so that we can
> write new code on top of new API. Otherwise this change will cause
> issues in the next merge window.

If you can get your patch into Ben's -next tree before the high .28-RCs come
out, I can just rebase my patch to that tree and make the changes to any new
callers of of_get_gpio() that are there.



More information about the Linuxppc-dev mailing list