Thread (6 messages) 6 messages, 4 authors, 2022-04-06

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

STALE1642d

From: Tobias Junghans <hidden>
Date: 2021-08-18 15:28:35
Subsystem: hid core layer, mcp2221a microchip usb-hid to i2c bridge driver, the rest · Maintainers: Jiri Kosina, Benjamin Tissoires, Rishi Gupta, Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help