summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
authorDirk Behme <dirk.behme@gmail.com>2015-08-18 18:02:32 +0200
committerLinus Walleij <linus.walleij@linaro.org>2015-10-02 04:19:35 -0700
commit48b5953ed826224a1332f2fd784d37d5f084ca9c (patch)
tree6e79a1b7e386c9d36f93072f76d6d168bd684487 /drivers/gpio/gpiolib.c
parent633a5065939ae75a07bc37c110399a3faf065147 (diff)
downloadlwn-48b5953ed826224a1332f2fd784d37d5f084ca9c.tar.gz
lwn-48b5953ed826224a1332f2fd784d37d5f084ca9c.zip
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: Dirk Behme <dirk.behme@gmail.com> Acked-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r--drivers/gpio/gpiolib.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 7c7c39c46eb7..8f180775a4fa 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -47,8 +47,6 @@
*/
DEFINE_SPINLOCK(gpio_lock);
-#define GPIO_OFFSET_VALID(chip, offset) (offset >= 0 && offset < chip->ngpio)
-
static DEFINE_MUTEX(gpio_lookup_lock);
static LIST_HEAD(gpio_lookup_list);
LIST_HEAD(gpio_chips);
@@ -995,7 +993,7 @@ const char *gpiochip_is_requested(struct gpio_chip *chip, unsigned offset)
{
struct gpio_desc *desc;
- if (!GPIO_OFFSET_VALID(chip, offset))
+ if (offset >= chip->ngpio)
return NULL;
desc = &chip->desc[offset];