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@xxxxxxxxxxxxxx> --- 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