summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/gpio.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-03-19 16:51:12 +0100
committerGreg Kroah-Hartman <greg@kroah.com>2015-03-19 17:29:40 +0100
commit83d9cddb85a0cc7497012846567d16add52916d4 (patch)
tree778c71baaa56a0489c405ca6e0ef55bab844d059 /drivers/staging/greybus/gpio.c
parent65f5a5f1614d1a3dab375588f5fd03590c87215b (diff)
greybus: gpio: remove overly defensive argument verification
Remove overly defensive argument verification in gpio-chip callbacks. We should trust gpiolib to get this right (or we would not even get any callback) just like the other gpio drivers do. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'drivers/staging/greybus/gpio.c')
-rw-r--r--drivers/staging/greybus/gpio.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
index a1bf1430fced..8384ad17e9be 100644
--- a/drivers/staging/greybus/gpio.c
+++ b/drivers/staging/greybus/gpio.c
@@ -415,8 +415,6 @@ 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 >= chip->ngpio)
- return -EINVAL;
ret = gb_gpio_activate_operation(gb_gpio_controller, (u8)offset);
if (ret)
; /* return ret; */
@@ -428,11 +426,6 @@ 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 >= chip->ngpio) {
- pr_err("bad offset %u supplied (must be 0..%u)\n",
- offset, chip->ngpio - 1);
- return;
- }
ret = gb_gpio_deactivate_operation(gb_gpio_controller, (u8)offset);
if (ret)
; /* return ret; */
@@ -444,8 +437,6 @@ static int gb_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
u8 which;
int ret;
- if (offset >= chip->ngpio)
- return -EINVAL;
which = (u8)offset;
ret = gb_gpio_get_direction_operation(gb_gpio_controller, which);
if (ret)
@@ -458,8 +449,6 @@ 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 >= chip->ngpio)
- return -EINVAL;
ret = gb_gpio_direction_in_operation(gb_gpio_controller, (u8)offset);
if (ret)
; /* return ret; */
@@ -472,8 +461,6 @@ 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 >= chip->ngpio)
- return -EINVAL;
ret = gb_gpio_direction_out_operation(gb_gpio_controller, (u8)offset, !!value);
if (ret)
; /* return ret; */
@@ -486,8 +473,6 @@ static int gb_gpio_get(struct gpio_chip *chip, unsigned offset)
u8 which;
int ret;
- if (offset >= chip->ngpio)
- return -EINVAL;
which = (u8)offset;
ret = gb_gpio_get_value_operation(gb_gpio_controller, which);
if (ret)
@@ -500,11 +485,6 @@ static void gb_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
struct gb_gpio_controller *gb_gpio_controller = gpio_chip_to_gb_gpio_controller(chip);
int ret;
- if (offset < 0 || offset >= chip->ngpio) {
- pr_err("bad offset %u supplied (must be 0..%u)\n",
- offset, chip->ngpio - 1);
- return;
- }
ret = gb_gpio_set_value_operation(gb_gpio_controller, (u8)offset, !!value);
if (ret)
; /* return ret; */
@@ -517,8 +497,6 @@ static int gb_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
u16 usec;
int ret;
- if (offset >= chip->ngpio)
- return -EINVAL;
if (debounce > U16_MAX)
return -EINVAL;
usec = (u16)debounce;