mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, "Samuel Holland" <samuel@sholland.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Uwe Kleine-König (The Capable Hub)"
	<u.kleine-koenig@baylibre.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Takashi Sakamoto" <o-takashi@sakamocchi.jp>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 09/10] Input: pinephone-keyboard - request IRQ before registering input device
Date: Mon, 23 Nov 2026 18:31:15 +0000	[thread overview]
Message-ID: <20261123183200.3900004-10-lee@kernel.org> (raw)
In-Reply-To: <20261123183200.3900004-1-lee@kernel.org>

ppkb_probe() registers ppkb->input before installing its threaded
interrupt handler with devm_request_threaded_irq().

As soon as input_register_device() exposes the keyboard (including
synchronous open by the console keyboard handler), ppkb_open() enables
matrix scanning.  If a key is held during this window, the controller
asserts its level-triggered interrupt line before the handler is
registered, causing the kernel to disable the unhandled IRQ.  In
addition, devres unwinds in reverse order on unbind, freeing the IRQ
handler before input unregistration invokes ppkb_close() to disable
scanning.

Request the threaded IRQ before calling input_register_device() so the
handler is in place before scanning can be enabled and outlives input
unregistration on teardown.

Fixes: 17406967ec0f ("Input: pinephone-keyboard - add PinePhone keyboard driver")
Closes: https://sashiko.dev/#/bug/linux-f24d8390-cd48-42d7-a3ea-c075b69c127a
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/input/keyboard/pinephone-keyboard.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/input/keyboard/pinephone-keyboard.c b/drivers/input/keyboard/pinephone-keyboard.c
index b4a02ade3a80..fdf2c270bacd 100644
--- a/drivers/input/keyboard/pinephone-keyboard.c
+++ b/drivers/input/keyboard/pinephone-keyboard.c
@@ -412,12 +412,6 @@ static int ppkb_probe(struct i2c_client *client)
 		return error;
 	}
 
-	error = input_register_device(ppkb->input);
-	if (error) {
-		dev_err(dev, "Failed to register input: %d\n", error);
-		return error;
-	}
-
 	error = devm_request_threaded_irq(dev, client->irq,
 					  NULL, ppkb_irq_thread,
 					  IRQF_ONESHOT, client->name, client);
@@ -426,6 +420,12 @@ static int ppkb_probe(struct i2c_client *client)
 		return error;
 	}
 
+	error = input_register_device(ppkb->input);
+	if (error) {
+		dev_err(dev, "Failed to register input: %d\n", error);
+		return error;
+	}
+
 	return 0;
 }
 
-- 
2.56.1.750.gf70dc682cf-goog


  parent reply	other threads:[~2026-11-23 18:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 18:31 [PATCH 00/10] Input: assorted bug fixes across input drivers Lee Jones
2026-11-23 18:31 ` [PATCH 01/10] Input: matrix_keypad - validate GPIO counts against matrix limits Lee Jones
2026-11-23 20:12   ` Dmitry Torokhov
2026-11-23 18:31 ` [PATCH 02/10] Input: cyapa - validate firmware image size in cyapa_pip_check_fw() Lee Jones
2026-11-23 18:31 ` [PATCH 03/10] Input: applespi - cancel touchpad registration work on removal Lee Jones
2026-11-23 20:13   ` Dmitry Torokhov
2026-11-23 18:31 ` [PATCH 04/10] Input: matrix_keypad - only stop and start active device across sleep Lee Jones
2026-11-23 18:31 ` [PATCH 05/10] Input: stinger - zero-initialise driver state in stinger_connect() Lee Jones
2026-11-23 20:19   ` Dmitry Torokhov
2026-11-23 18:31 ` [PATCH 06/10] Input: synaptics-rmi4 - check for NULL drvdata in rmi_set_attn_data() Lee Jones
2026-11-23 18:31 ` [PATCH 07/10] Input: axp20x-pek - skip IRQ handling during sleep without input device Lee Jones
2026-11-23 20:22   ` Dmitry Torokhov
2026-11-23 18:31 ` [PATCH 08/10] Input: mt6779-keypad - enable keypad clock before programming registers Lee Jones
2026-11-23 20:25   ` Dmitry Torokhov
2026-11-23 18:31 ` Lee Jones [this message]
2026-11-23 20:25   ` [PATCH 09/10] Input: pinephone-keyboard - request IRQ before registering input device Dmitry Torokhov
2026-11-23 18:31 ` [PATCH 10/10] Input: wacom_w8001 - use reinit_completion() in w8001_command() Lee Jones
2026-11-23 20:26   ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261123183200.3900004-10-lee@kernel.org \
    --to=lee@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=dakr@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=o-takashi@sakamocchi.jp \
    --cc=samuel@sholland.org \
    --cc=stable@vger.kernel.org \
    --cc=u.kleine-koenig@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®