diff options
author | Axel Lin <axel.lin@ingics.com> | 2014-12-17 04:47:14 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-01-07 04:40:32 -0500 |
commit | 5afb287a06ce869827563cbd2b0a035800dd6f5d (patch) | |
tree | 60c0448959a016fa1ddcefe3b5f104de596a034f | |
parent | 0acb0e712b57b4bcabc5fdcb3e445cfce0f80340 (diff) |
gpio: dln2: Fix gpio output value in dln2_gpio_direction_output()
dln2_gpio_direction_output() ignored the state passed into it. Fix it.
Also make dln2_gpio_pin_set_out_val return int, so we can check the error value.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Daniel Baluta <daniel.baluta@intel.com>
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/gpio/gpio-dln2.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/gpio/gpio-dln2.c b/drivers/gpio/gpio-dln2.c index 28a62c48ecba..2ff46192a70d 100644 --- a/drivers/gpio/gpio-dln2.c +++ b/drivers/gpio/gpio-dln2.c | |||
@@ -140,16 +140,16 @@ static int dln2_gpio_pin_get_out_val(struct dln2_gpio *dln2, unsigned int pin) | |||
140 | return !!ret; | 140 | return !!ret; |
141 | } | 141 | } |
142 | 142 | ||
143 | static void dln2_gpio_pin_set_out_val(struct dln2_gpio *dln2, | 143 | static int dln2_gpio_pin_set_out_val(struct dln2_gpio *dln2, |
144 | unsigned int pin, int value) | 144 | unsigned int pin, int value) |
145 | { | 145 | { |
146 | struct dln2_gpio_pin_val req = { | 146 | struct dln2_gpio_pin_val req = { |
147 | .pin = cpu_to_le16(pin), | 147 | .pin = cpu_to_le16(pin), |
148 | .value = value, | 148 | .value = value, |
149 | }; | 149 | }; |
150 | 150 | ||
151 | dln2_transfer_tx(dln2->pdev, DLN2_GPIO_PIN_SET_OUT_VAL, &req, | 151 | return dln2_transfer_tx(dln2->pdev, DLN2_GPIO_PIN_SET_OUT_VAL, &req, |
152 | sizeof(req)); | 152 | sizeof(req)); |
153 | } | 153 | } |
154 | 154 | ||
155 | #define DLN2_GPIO_DIRECTION_IN 0 | 155 | #define DLN2_GPIO_DIRECTION_IN 0 |
@@ -266,6 +266,13 @@ static int dln2_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | |||
266 | static int dln2_gpio_direction_output(struct gpio_chip *chip, unsigned offset, | 266 | static int dln2_gpio_direction_output(struct gpio_chip *chip, unsigned offset, |
267 | int value) | 267 | int value) |
268 | { | 268 | { |
269 | struct dln2_gpio *dln2 = container_of(chip, struct dln2_gpio, gpio); | ||
270 | int ret; | ||
271 | |||
272 | ret = dln2_gpio_pin_set_out_val(dln2, offset, value); | ||
273 | if (ret < 0) | ||
274 | return ret; | ||
275 | |||
269 | return dln2_gpio_set_direction(chip, offset, DLN2_GPIO_DIRECTION_OUT); | 276 | return dln2_gpio_set_direction(chip, offset, DLN2_GPIO_DIRECTION_OUT); |
270 | } | 277 | } |
271 | 278 | ||