Skip to contentSkip to conversation

misc/led: LED state is set opposite of what is expected

PATCH RESEND Applied Glenn Miles 3 participants 4 messages Oct 24, 2023 – Oct 27, 2023

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/1 misc/led: LED state is set opposite of what is expected

Testing of the LED state showed that when the LED polarity was set to GPIO_POLARITY_ACTIVE_LOW and a low logic value was set on the input GPIO of the LED, the LED was being turn off when it was expected to be turned on.

---

Changes from v1:
- Changed logic for readability

 hw/misc/led.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/misc/led.c +1 -1
index f6d6d68bce..42bb43a39a 100644
@@ -63,7 +63,7 @@ static void led_set_state_gpio_handler(void *opaque, int line, int new_state)
     LEDState *s = LED(opaque);
 
     assert(line == 0);
-    led_set_state(s, !!new_state != s->gpio_active_high);
+    led_set_state(s, !!new_state == s->gpio_active_high);
 }
 
 static void led_reset(DeviceState *dev)
Signature · 1 line
2.31.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 29 lines · Glenn Miles

Testing of the LED state showed that when the LED polarity was set to GPIO_POLARITY_ACTIVE_LOW and a low logic value was set on the input GPIO of the LED, the LED was being turn off when it was expected to be turned on.

---

Changes from v1:
- Changed logic for readability

 hw/misc/led.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/misc/led.c +1 -2
index f6d6d68bce..42bb43a39a 100644
@@ -63,7 +63,7 @@ static void led_set_state_gpio_handler(void *opaque, int line, int new_state)
     LEDState *s = LED(opaque);
 
     assert(line == 0);
-    led_set_state(s, !!new_state != s->gpio_active_high);
+    led_set_state(s, !!new_state == s->gpio_active_high);
 }
 
 static void led_reset(DeviceState *dev)
--
Quoted 1 line

2.31.1

thanks
-- PMM

#2 lore raw
In reply to Glenn Miles
Quoted 8 lines · Glenn Miles

Testing of the LED state showed that when the LED polarity was set to GPIO_POLARITY_ACTIVE_LOW and a low logic value was set on the input GPIO of the LED, the LED was being turn off when it was expected to be turned on.

---

Applied to target-arm.next, thanks.

-- PMM

#3 lore raw
Quoted 7 lines · Peter Maydell
Quoted 6 lines · Glenn Miles

Testing of the LED state showed that when the LED polarity was set to GPIO_POLARITY_ACTIVE_LOW and a low logic value was set on the input GPIO of the LED, the LED was being turn off when it was expected to be turned on.

Quoted 6 lines
Quoted 2 lines

---

Applied to target-arm.next, thanks.

Sorry I'm still catching up.

Fixes ddb67f6402 ("hw/misc/led: Allow connecting from GPIO output")