[PATCH] at91: at91-ohci: fix set/get power

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Mon Nov 14 15:51:29 EST 2011


Le Mon, 14 Nov 2011 22:39:21 +0200,
Andrew Victor <avictor.za at gmail.com> a écrit :

> Shouldn't that rather be:
>    if (!gpio_is_valid(pdata->vbus_pin[port]))
>           return;

No, because gpio_is_valid() accept 0 as a valid GPIO. Therefore, when
you don't set anything for the .vbus_pin field, the values are zero,
and gpio_is_valid() will tell you that it's a valid GPIO. If we wanted
to use gpio_is_valid(), we would have to do something like .vbus_pin =
{ -EINVAL, -EINVAL } in every board for which the vbus pin isn't used.
It's a quite unfortunate behaviour of the current gpio subsystem.

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com



More information about the linux-arm-kernel mailing list