diff mbox series

[v2,RESEND] misc/led: LED state is set opposite of what is expected

Message ID 20231024191945.4135036-1-milesg@linux.vnet.ibm.com
State New
Headers show
Series [v2,RESEND] misc/led: LED state is set opposite of what is expected | expand

Commit Message

Glenn Miles Oct. 24, 2023, 7:19 p.m. UTC
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.

Signed-off-by: Glenn Miles <milesg@linux.vnet.ibm.com>
---

Changes from v1:
    - Changed logic for readability

 hw/misc/led.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Maydell Oct. 25, 2023, 12:59 p.m. UTC | #1
On Tue, 24 Oct 2023 at 20:20, Glenn Miles <milesg@linux.vnet.ibm.com> wrote:
>
> 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.
>
> Signed-off-by: Glenn Miles <milesg@linux.vnet.ibm.com>
> ---
>
> Changes from v1:
>     - Changed logic for readability
>
>  hw/misc/led.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/misc/led.c b/hw/misc/led.c
> index f6d6d68bce..42bb43a39a 100644
> --- a/hw/misc/led.c
> +++ b/hw/misc/led.c
> @@ -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)
> --
> 2.31.1

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
Peter Maydell Oct. 27, 2023, 11:51 a.m. UTC | #2
On Tue, 24 Oct 2023 at 20:20, Glenn Miles <milesg@linux.vnet.ibm.com> wrote:
>
> 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.
>
> Signed-off-by: Glenn Miles <milesg@linux.vnet.ibm.com>
> ---



Applied to target-arm.next, thanks.

-- PMM
Philippe Mathieu-Daudé Oct. 27, 2023, 1:33 p.m. UTC | #3
On 27/10/23 13:51, Peter Maydell wrote:
> On Tue, 24 Oct 2023 at 20:20, Glenn Miles <milesg@linux.vnet.ibm.com> wrote:
>>
>> 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.
>>
>> Signed-off-by: Glenn Miles <milesg@linux.vnet.ibm.com>
>> ---
> 
> 
> 
> Applied to target-arm.next, thanks.

Sorry I'm still catching up.

Fixes: ddb67f6402 ("hw/misc/led: Allow connecting from GPIO output")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/hw/misc/led.c b/hw/misc/led.c
index f6d6d68bce..42bb43a39a 100644
--- a/hw/misc/led.c
+++ b/hw/misc/led.c
@@ -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)