greybus: gpio-gb: remove checks for negative offset variable

offset is defined as unsigned so there is no point checking for
negative values of offset.

Signed-off-by: Bill Pemberton <wfp5p@worldbroken.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This commit is contained in:
Bill Pemberton 2015-01-16 13:57:32 -05:00 committed by Greg Kroah-Hartman
parent 9d677cf604
commit 76590b1e88
1 changed files with 8 additions and 8 deletions

View File

@ -312,7 +312,7 @@ static int gb_gpio_request(struct gpio_chip *chip, unsigned offset)
struct gb_gpio_controller *gb_gpio_controller = gpio_chip_to_gb_gpio_controller(chip);
int ret;
if (offset < 0 || offset >= chip->ngpio)
if (offset >= chip->ngpio)
return -EINVAL;
ret = gb_gpio_activate_operation(gb_gpio_controller, (u8)offset);
if (ret)
@ -325,7 +325,7 @@ static void gb_gpio_free(struct gpio_chip *chip, unsigned offset)
struct gb_gpio_controller *gb_gpio_controller = gpio_chip_to_gb_gpio_controller(chip);
int ret;
if (offset < 0 || offset >= chip->ngpio) {
if (offset >= chip->ngpio) {
pr_err("bad offset %u supplied (must be 0..%u)\n",
offset, chip->ngpio - 1);
return;
@ -341,7 +341,7 @@ static int gb_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
u8 which;
int ret;
if (offset < 0 || offset >= chip->ngpio)
if (offset >= chip->ngpio)
return -EINVAL;
which = (u8)offset;
ret = gb_gpio_get_direction_operation(gb_gpio_controller, which);
@ -355,7 +355,7 @@ static int gb_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
struct gb_gpio_controller *gb_gpio_controller = gpio_chip_to_gb_gpio_controller(chip);
int ret;
if (offset < 0 || offset >= chip->ngpio)
if (offset >= chip->ngpio)
return -EINVAL;
ret = gb_gpio_direction_in_operation(gb_gpio_controller, (u8)offset);
if (ret)
@ -369,7 +369,7 @@ static int gb_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
struct gb_gpio_controller *gb_gpio_controller = gpio_chip_to_gb_gpio_controller(chip);
int ret;
if (offset < 0 || offset >= chip->ngpio)
if (offset >= chip->ngpio)
return -EINVAL;
ret = gb_gpio_direction_out_operation(gb_gpio_controller, (u8)offset, !!value);
if (ret)
@ -383,7 +383,7 @@ static int gb_gpio_get(struct gpio_chip *chip, unsigned offset)
u8 which;
int ret;
if (offset < 0 || offset >= chip->ngpio)
if (offset >= chip->ngpio)
return -EINVAL;
which = (u8)offset;
ret = gb_gpio_get_value_operation(gb_gpio_controller, which);
@ -414,7 +414,7 @@ static int gb_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
u16 usec;
int ret;
if (offset < 0 || offset >= chip->ngpio)
if (offset >= chip->ngpio)
return -EINVAL;
if (debounce > (unsigned int)U16_MAX)
return -EINVAL;
@ -428,7 +428,7 @@ static int gb_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
static int gb_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{
if (offset < 0 || offset >= chip->ngpio)
if (offset >= chip->ngpio)
return -EINVAL;
return 0; /* XXX */