Commit 48b5953e authored by Dirk Behme's avatar Dirk Behme Committed by Linus Walleij

gpio: gpiolib: don't compare an unsigned for >= 0

The parameter offset is an unsigned, so it makes no sense to compare
it for >= 0. Fix the compiler warning regarding this by removing this
comparison.

As the macro GPIO_OFFSET_VALID is only used at this single place, simplify
the code by dropping the macro completely and dropping the invert, too.

No functional change.
Signed-off-by: default avatarDirk Behme <dirk.behme@gmail.com>
Acked-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 633a5065
...@@ -47,8 +47,6 @@ ...@@ -47,8 +47,6 @@
*/ */
DEFINE_SPINLOCK(gpio_lock); DEFINE_SPINLOCK(gpio_lock);
#define GPIO_OFFSET_VALID(chip, offset) (offset >= 0 && offset < chip->ngpio)
static DEFINE_MUTEX(gpio_lookup_lock); static DEFINE_MUTEX(gpio_lookup_lock);
static LIST_HEAD(gpio_lookup_list); static LIST_HEAD(gpio_lookup_list);
LIST_HEAD(gpio_chips); LIST_HEAD(gpio_chips);
...@@ -995,7 +993,7 @@ const char *gpiochip_is_requested(struct gpio_chip *chip, unsigned offset) ...@@ -995,7 +993,7 @@ const char *gpiochip_is_requested(struct gpio_chip *chip, unsigned offset)
{ {
struct gpio_desc *desc; struct gpio_desc *desc;
if (!GPIO_OFFSET_VALID(chip, offset)) if (offset >= chip->ngpio)
return NULL; return NULL;
desc = &chip->desc[offset]; desc = &chip->desc[offset];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment