Thread (18 messages) flat view 18 messages, 6 authors, 2d ago

Re: [PATCH 2/2] Input: gpio-keys - support wakeup pinctrl state on suspend

From: sashiko-bot@kernel.org
Date: 2026-09-12 21:42:13
Also in: linux-input

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing restoration of default pinctrl state on error path in gpio_keys_enable_wakeup().
--

commit 794b05f8c21f23224e4ff7b076c2d675310e6432
Author: Kendall Willis [off-list ref]

Input: gpio-keys - support wakeup pinctrl state on suspend

This commit enables GPIO controllers on TI K3 AM62 devices to act as a wakeup
source during suspend to RAM by selecting a wakeup pinctrl state and restoring
the default on resume.
quoted hunk ↗ jump to hunk
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 129fc4212a5ed..b409e17970519 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -1010,6 +1017,9 @@ gpio_keys_enable_wakeup(struct gpio_keys_drvdata *ddata)
 	int error;
 	int i;
 
+	if (!IS_ERR_OR_NULL(ddata->pinctrl_wakeup))
+		pinctrl_select_state(ddata->pinctrl, ddata->pinctrl_wakeup);
+
 	for (i = 0; i < ddata->pdata->nbuttons; i++) {
 		bdata = &ddata->data[i];
 		if (bdata->button->wakeup) {
[Severity: Medium]
Does the error path in this function need to restore the default pinctrl
state?

Looking at gpio_keys_enable_wakeup in drivers/input/keyboard/gpio_keys.c,
the pinctrl state is changed to wakeup at the start of the function.
However, if gpio_keys_button_enable_wakeup fails for any button, the code
jumps to the err_out label:

err_out:
        while (i--) {
                bdata = &ddata->data[i];
                if (bdata->button->wakeup)
                        gpio_keys_button_disable_wakeup(bdata);
                bdata->suspended = false;
        }

        return error;

Since a failure here aborts the device's suspend transition, the PM core
will not invoke the corresponding resume callback. Could this leave the
hardware pins stuck in the wakeup configuration instead of reverting to the
default state for normal runtime operation?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260912-upstream-gpio-wakeup-v1-0-f0e12484b836@ti.com?part=2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help