From: Bernhard Beschow Date: Thu, 1 May 2025 18:34:45 +0000 (+0200) Subject: hw/gpio/imx_gpio: Fix interpretation of GDIR polarity X-Git-Tag: v9.2.4~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9e13cd7232c1e528962acf8c17c664da5e80d548;p=thirdparty%2Fqemu.git hw/gpio/imx_gpio: Fix interpretation of GDIR polarity According to the i.MX 8M Plus reference manual, a GPIO pin is configured as an output when the corresponding bit in the GDIR register is set. The function imx_gpio_set_int_line() is intended to be a no-op if the pin is configured as an output, returning early in such cases. However, it inverts the condition. Fix this by returning early when the bit is set. cc: qemu-stable@nongnu.org Fixes: f44272809779 ("i.MX: Add GPIO device") Signed-off-by: Bernhard Beschow Message-id: 20250501183445.2389-4-shentey@gmail.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell (cherry picked from commit eba837a31b9579e30cc6d7ecb4b5c2662a6ffaba) Signed-off-by: Michael Tokarev --- diff --git a/hw/gpio/imx_gpio.c b/hw/gpio/imx_gpio.c index 27535a577f..e3ed6b2a63 100644 --- a/hw/gpio/imx_gpio.c +++ b/hw/gpio/imx_gpio.c @@ -79,7 +79,7 @@ static void imx_gpio_update_int(IMXGPIOState *s) static void imx_gpio_set_int_line(IMXGPIOState *s, int line, IMXGPIOLevel level) { /* if this signal isn't configured as an input signal, nothing to do */ - if (!extract32(s->gdir, line, 1)) { + if (extract32(s->gdir, line, 1)) { return; }