* [PATCH v2] gpio: dln2: Fix gpio output value in dln2_gpio_direction_output()
@ 2014-12-17 9:47 Axel Lin
2015-01-07 9:41 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2014-12-17 9:47 UTC (permalink / raw)
To: Linus Walleij, Alexandre Courbot
Cc: Daniel Baluta, linux-gpio@vger.kernel.org, Octavian Purdila
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>
---
v2: Address Octavian's comment.
drivers/gpio/gpio-dln2.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-dln2.c b/drivers/gpio/gpio-dln2.c
index 978b51e..2481e8d 100644
--- a/drivers/gpio/gpio-dln2.c
+++ b/drivers/gpio/gpio-dln2.c
@@ -141,16 +141,16 @@ static int dln2_gpio_pin_get_out_val(struct dln2_gpio *dln2, unsigned int pin)
return !!ret;
}
-static void dln2_gpio_pin_set_out_val(struct dln2_gpio *dln2,
- unsigned int pin, int value)
+static int dln2_gpio_pin_set_out_val(struct dln2_gpio *dln2,
+ unsigned int pin, int value)
{
struct dln2_gpio_pin_val req = {
.pin = cpu_to_le16(pin),
.value = value,
};
- dln2_transfer_tx(dln2->pdev, DLN2_GPIO_PIN_SET_OUT_VAL, &req,
- sizeof(req));
+ return dln2_transfer_tx(dln2->pdev, DLN2_GPIO_PIN_SET_OUT_VAL, &req,
+ sizeof(req));
}
#define DLN2_GPIO_DIRECTION_IN 0
@@ -267,6 +267,13 @@ static int dln2_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
static int dln2_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
int value)
{
+ struct dln2_gpio *dln2 = container_of(chip, struct dln2_gpio, gpio);
+ int ret;
+
+ ret = dln2_gpio_pin_set_out_val(dln2, offset, value);
+ if (ret < 0)
+ return ret;
+
return dln2_gpio_set_direction(chip, offset, DLN2_GPIO_DIRECTION_OUT);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] gpio: dln2: Fix gpio output value in dln2_gpio_direction_output()
2014-12-17 9:47 [PATCH v2] gpio: dln2: Fix gpio output value in dln2_gpio_direction_output() Axel Lin
@ 2015-01-07 9:41 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2015-01-07 9:41 UTC (permalink / raw)
To: Axel Lin
Cc: Alexandre Courbot, Daniel Baluta, linux-gpio@vger.kernel.org,
Octavian Purdila
On Wed, Dec 17, 2014 at 10:47 AM, Axel Lin <axel.lin@ingics.com> wrote:
> 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>
> ---
> v2: Address Octavian's comment.
This v2 patch applied for fixes.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-07 9:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-17 9:47 [PATCH v2] gpio: dln2: Fix gpio output value in dln2_gpio_direction_output() Axel Lin
2015-01-07 9:41 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).