gpio: Convert gpio_is_valid to return bool
Make the code a bit more readable. Instead of casting an int to an unsigned then comparing to MAX_NR_GPIOS, add a >= 0 test and let the compiler optimizer do the conversion to unsigned. The generated code should be the same. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This commit is contained in:
committed by
Grant Likely
parent
82ab0f75ee
commit
3474cb3cc0
@@ -25,9 +25,9 @@ struct gpio_chip;
|
||||
* warning when something is wrongly called.
|
||||
*/
|
||||
|
||||
static inline int gpio_is_valid(int number)
|
||||
static inline bool gpio_is_valid(int number)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline int gpio_request(unsigned gpio, const char *label)
|
||||
|
||||
Reference in New Issue
Block a user