[U-Boot] [PATCH] gpio: omap_gpio: Remove check_gpio() function
Axel Lin
axel.lin at ingics.com
Thu Jun 20 09:20:45 CEST 2013
2013/6/20 Nikita Kiryanov <nikita at compulab.co.il>
> Hi Axel,
>
>
> On 06/20/2013 04:03 AM, Axel Lin wrote:
>
>> check_gpio() and gpio_is_valid() are both used to check if a gpio is
>> valid or
>> not. It looks pointless to have both function because we can just call
>> gpio_is_valid() instead of check_gpio(). Thus remove check_gpio()
>> function.
>>
>
> I don't see the benefit in this patch.
> The functions clearly exist for different reasons: gpio_is_valid() is
> part of the gpio api, while check_gpio() exists to attach an error
> message to a failed validity check without causing code duplication all
> over omap_gpio.c.
>
How about just showing error in gpio_is_valid() and then remove
check_gpio()?
int gpio_is_valid(int gpio)
{
if ((gpio >= 0) && (gpio < 192))
return 1;
printf("ERROR : invalid GPIO %d\n", gpio);
return 0;
}
> Essentially what you are doing is removing a helpful error message.
My intention is to remove redundant code.
Regards,
Axel
More information about the U-Boot
mailing list