diff mbox series

[1/2] HID: mcp2221: enable HID I/O during probe

Message ID 20210818152743.163929-1-tobias.junghans@inhub.de
State New
Headers show
Series [1/2] HID: mcp2221: enable HID I/O during probe | expand

Commit Message

Tobias Junghans Aug. 18, 2021, 3:27 p.m. UTC
devm_gpiochip_add_data() calls the gpio_chip->get_direction handler
for each line, resulting in device I/O in mcp_gpio_get_direction().
However unless hid_device_io_start() is called, mcp2221_raw_event()
is not called during probe, causing mcp_gpio_get_direction() to time
out. This fixes that probing takes 12 seconds to complete.

Signed-off-by: Tobias Junghans <tobias.junghans@inhub.de>
---
 drivers/hid/hid-mcp2221.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

rishi gupta April 6, 2022, 3:54 p.m. UTC | #1
Thanks Tobias for the patch!

Reviewed-by: Rishi Gupta <gupt21@gmail.com>


On Wed, Aug 18, 2021 at 8:28 AM Tobias Junghans
<tobias.junghans@inhub.de> wrote:
>
> devm_gpiochip_add_data() calls the gpio_chip->get_direction handler
> for each line, resulting in device I/O in mcp_gpio_get_direction().
> However unless hid_device_io_start() is called, mcp2221_raw_event()
> is not called during probe, causing mcp_gpio_get_direction() to time
> out. This fixes that probing takes 12 seconds to complete.
>
> Signed-off-by: Tobias Junghans <tobias.junghans@inhub.de>
> ---
>  drivers/hid/hid-mcp2221.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/hid/hid-mcp2221.c b/drivers/hid/hid-mcp2221.c
> index 4211b9839209..8e54173b195c 100644
> --- a/drivers/hid/hid-mcp2221.c
> +++ b/drivers/hid/hid-mcp2221.c
> @@ -895,7 +895,10 @@ static int mcp2221_probe(struct hid_device *hdev,
>         mcp->gc->can_sleep = 1;
>         mcp->gc->parent = &hdev->dev;
>
> +       hid_device_io_start(hdev);
>         ret = devm_gpiochip_add_data(&hdev->dev, mcp->gc, mcp);
> +       hid_device_io_stop(hdev);
> +
>         if (ret)
>                 goto err_gc;
>
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/hid/hid-mcp2221.c b/drivers/hid/hid-mcp2221.c
index 4211b9839209..8e54173b195c 100644
--- a/drivers/hid/hid-mcp2221.c
+++ b/drivers/hid/hid-mcp2221.c
@@ -895,7 +895,10 @@  static int mcp2221_probe(struct hid_device *hdev,
 	mcp->gc->can_sleep = 1;
 	mcp->gc->parent = &hdev->dev;
 
+	hid_device_io_start(hdev);
 	ret = devm_gpiochip_add_data(&hdev->dev, mcp->gc, mcp);
+	hid_device_io_stop(hdev);
+
 	if (ret)
 		goto err_gc;