Skip to contentSkip to conversation

gpio: dln2: Fix gpio output value in dln2_gpio_direction_output()

PATCH Superseded Axel Lin 4 participants 8 messages Dec 16, 2014 – Dec 17, 2014 GPIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 gpio: dln2: Fix gpio output value in dln2_gpio_direction_output()

dln2_gpio_direction_output() ignored the state passed into it. Fix it.

---
I don't have this hardware handy, so only compile test.

 drivers/gpio/gpio-dln2.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpio/gpio-dln2.c +1 -0
index 978b51e..1434844 100644
@@ -267,6 +267,7 @@ 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)
 {
+	dln2_gpio_set(chip, offset, value);
 	return dln2_gpio_set_direction(chip, offset, DLN2_GPIO_DIRECTION_OUT);
 }
 
Signature · 1 line
1.9.1
Tested-by on v1 1/1
#1 lore raw
Quoted 3 lines · Axel Lin

dln2_gpio_direction_output() ignored the state passed into it. Fix it.

Quoted 18 lines

---
I don't have this hardware handy, so only compile test.

  drivers/gpio/gpio-dln2.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpio/gpio-dln2.c +1 -0
index 978b51e..1434844 100644
@@ -267,6 +267,7 @@ 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)
  {
+	dln2_gpio_set(chip, offset, value);
  	return dln2_gpio_set_direction(chip, offset, DLN2_GPIO_DIRECTION_OUT);
  }
 
#3 lore raw
Quoted 10 lines · Alexandre Courbot
Quoted 9 lines · Daniel Baluta
Quoted 4 lines · Axel Lin

dln2_gpio_direction_output() ignored the state passed into it. Fix it.

Quoted 6 lines
Quoted 1 line

But this seems to apply to patches in mid-flight, could it be squashed there maybe?

Sure, I can add it to the existing series, but I prefer to keep it as separate patch. Is that ok with you?

#4 lore raw
Quoted 13 lines · Octavian Purdila
Quoted 12 lines · Alexandre Courbot
Quoted 10 lines · Daniel Baluta
Quoted 4 lines · Axel Lin

dln2_gpio_direction_output() ignored the state passed into it. Fix it.

Quoted 7 lines
Quoted 4 lines

But this seems to apply to patches in mid-flight, could it be squashed there maybe?

Sure, I can add it to the existing series, but I prefer to keep it as separate patch. Is that ok with you?

Why? This is clearly a fix, so if the series is not merged yet, doesn't it make more sense to squash it and have the desired functionality from the start?

#5 lore raw
Quoted 20 lines · Alexandre Courbot
Quoted 18 lines · Octavian Purdila
Quoted 16 lines · Alexandre Courbot
Quoted 10 lines · Daniel Baluta
Quoted 4 lines · Axel Lin

dln2_gpio_direction_output() ignored the state passed into it. Fix it.

But this seems to apply to patches in mid-flight, could it be squashed there maybe?

Quoted 6 lines
Quoted 2 lines

Sure, I can add it to the existing series, but I prefer to keep it as separate patch. Is that ok with you?

Why? This is clearly a fix, so if the series is not merged yet, doesn't it make more sense to squash it and have the desired functionality from the start?

The fix is not for issues introduced by the series, but for an issue existing in the already merged code. Also it is a separate issue then the one fixed in the other patches in the series.

AFAIK each fix should be in a separate patch, am I missing something?

#6 lore raw
Quoted 24 lines · Octavian Purdila
Quoted 23 lines · Alexandre Courbot
Quoted 20 lines · Octavian Purdila
Quoted 10 lines · Alexandre Courbot
Quoted 9 lines · Daniel Baluta
Quoted 4 lines · Axel Lin

dln2_gpio_direction_output() ignored the state passed into it. Fix it.

Quoted 6 lines
Quoted 1 line

But this seems to apply to patches in mid-flight, could it be squashed there maybe?

Sure, I can add it to the existing series, but I prefer to keep it as separate patch. Is that ok with you?

Quoted 7 lines
Quoted 3 lines

Why? This is clearly a fix, so if the series is not merged yet, doesn't it make more sense to squash it and have the desired functionality from the start?

The fix is not for issues introduced by the series, but for an issue existing in the already merged code. Also it is a separate issue then the one fixed in the other patches in the series.

Allright, I thought none of the DL2 support has been fixed yet (as I cannot see it in Linus W.'s tree). You know better what the state of your patches is, so please do what you think is best.

Reviewed-by
#7 lore raw
In reply to Daniel Baluta
Quoted 3 lines · Daniel Baluta

On 12/16/2014 04:40 PM, Axel Lin wrote:

Hi Axel,

Nice catch!

Quoted 13 lines
Quoted 4 lines

dln2_gpio_direction_output() ignored the state passed into it. Fix it.

Quoted 5 lines

---
I don't have this hardware handy, so only compile test.

  drivers/gpio/gpio-dln2.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 11 lines

drivers/gpio/gpio-dln2.c static int dln2_gpio_direction_input(struct gpio_chip · line 272

Quoted 11 lines
drivers/gpio/gpio-dln2.c +1 -0
index 978b51e..1434844 100644
@@ -267,6 +267,7 @@ 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)
  {
+       dln2_gpio_set(chip, offset, value);

Could you change dln2_gpio_pin_set_out_val's signature to return an error code than use it instead of dln2_gpio_set here? Then we can check the error value. With that: