From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: lgo@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/4] input: record parent device at registration time
Date: Tue, 2 Apr 2024 15:50:32 +0200 [thread overview]
Message-ID: <20240402135035.3700601-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240402135035.3700601-1-a.fatoum@pengutronix.de>
The input core doesn't create a virtual device to represent the input
device. Still having a pointer to the parent device can be useful for
debugging purposes.
Add a parent member and start populating it.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/input/gpio_keys.c | 1 +
drivers/input/imx_keypad.c | 1 +
drivers/input/usb_kbd.c | 1 +
drivers/input/virtio_input.c | 1 +
include/input/input.h | 1 +
5 files changed, 5 insertions(+)
diff --git a/drivers/input/gpio_keys.c b/drivers/input/gpio_keys.c
index c23d20563c38..190865b7f244 100644
--- a/drivers/input/gpio_keys.c
+++ b/drivers/input/gpio_keys.c
@@ -162,6 +162,7 @@ static int __init gpio_keys_probe(struct device *dev)
gk->buttons[i].previous_state = gk->buttons[i].active_low;
}
+ gk->input.parent = dev;
ret = input_device_register(&gk->input);
if (ret)
return ret;
diff --git a/drivers/input/imx_keypad.c b/drivers/input/imx_keypad.c
index fc6b45b3cb62..2c003905a7d9 100644
--- a/drivers/input/imx_keypad.c
+++ b/drivers/input/imx_keypad.c
@@ -410,6 +410,7 @@ static int __init imx_keypad_probe(struct device *dev)
if (ret)
return ret;
+ keypad->input.parent = dev;
ret = input_device_register(&keypad->input);
if (ret)
return ret;
diff --git a/drivers/input/usb_kbd.c b/drivers/input/usb_kbd.c
index 86b48db2a72b..2e75aabf3da4 100644
--- a/drivers/input/usb_kbd.c
+++ b/drivers/input/usb_kbd.c
@@ -188,6 +188,7 @@ static int usb_kbd_probe(struct usb_device *usbdev,
} else
dev_dbg(&usbdev->dev, "poll keyboard via int ep\n");
+ data->input.parent = &usbdev->dev;
ret = input_device_register(&data->input);
if (ret) {
dev_err(&usbdev->dev, "can't register input\n");
diff --git a/drivers/input/virtio_input.c b/drivers/input/virtio_input.c
index 5c6849b561eb..655a9051726a 100644
--- a/drivers/input/virtio_input.c
+++ b/drivers/input/virtio_input.c
@@ -216,6 +216,7 @@ static int virtinput_probe(struct virtio_device *vdev)
virtio_device_ready(vdev);
+ vi->idev.parent = &vdev->dev;
err = input_device_register(&vi->idev);
if (err)
goto err_input_register;
diff --git a/include/input/input.h b/include/input/input.h
index d169c647bdaf..9445d20e566b 100644
--- a/include/input/input.h
+++ b/include/input/input.h
@@ -14,6 +14,7 @@ struct input_event {
struct input_device {
struct list_head list;
+ struct device *parent;
DECLARE_BITMAP(keys, KEY_CNT);
};
--
2.39.2
next prev parent reply other threads:[~2024-04-02 15:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 13:50 [PATCH 0/4] input: add CONFIG_INPUT_EVBUG debug option Ahmad Fatoum
2024-04-02 13:50 ` Ahmad Fatoum [this message]
2024-04-02 13:50 ` [PATCH 2/4] " Ahmad Fatoum
2024-04-02 13:50 ` [PATCH 3/4] input: imx-keypad: remove now-duplicate debug messages Ahmad Fatoum
2024-04-02 14:06 ` Ahmad Fatoum
2024-04-03 11:40 ` Sascha Hauer
2024-04-02 13:50 ` [PATCH 4/4] input: gpio-keys: drop now-superfluous struct gpio_keys::dev Ahmad Fatoum
2024-04-03 11:39 ` [PATCH 0/4] input: add CONFIG_INPUT_EVBUG debug option Sascha Hauer
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=20240402135035.3700601-2-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=lgo@pengutronix.de \
/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