greybus: gpio: fix truncated debounce times

Fix set_debounce, which silently truncated the time argument to 255us
even though we support 16-bit values.

Also remove the unnecessary explicit cast when verifying the argument.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This commit is contained in:
Johan Hovold 2015-03-19 16:51:09 +01:00 committed by Greg Kroah-Hartman
parent c0d209a07b
commit c2a6610686

View File

@ -543,9 +543,9 @@ static int gb_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
if (offset >= chip->ngpio)
return -EINVAL;
if (debounce > (unsigned int)U16_MAX)
if (debounce > U16_MAX)
return -EINVAL;
usec = (u8)debounce;
usec = (u16)debounce;
ret = gb_gpio_set_debounce_operation(gb_gpio_controller, (u8)offset, usec);
if (ret)
; /* return ret; */