Skip to content

Commit 73ce9f1

Browse files
Hamish MartinJiri Kosina
authored andcommitted
HID: mcp2221: Allow IO to start during probe
During the probe we add an I2C adapter and as soon as we add that adapter it may be used for a transfer (e.g via the code in i2cdetect()). Those transfers are not able to complete and time out. This is because the HID raw_event callback (mcp2221_raw_event) will not be invoked until the HID device's 'driver_input_lock' is marked up at the completion of the probe in hid_device_probe(). This starves the driver of the responses it is waiting for. In order to allow the I2C transfers to complete while we are still in the probe, start the IO once we have completed init of the HID device. This issue seems to have been seen before and a patch was submitted but it seems it was never accepted. See: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Hamish Martin <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent f2d4a58 commit 73ce9f1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/hid/hid-mcp2221.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,8 @@ static int mcp2221_probe(struct hid_device *hdev,
11421142
if (ret)
11431143
return ret;
11441144

1145+
hid_device_io_start(hdev);
1146+
11451147
/* Set I2C bus clock diviser */
11461148
if (i2c_clk_freq > 400)
11471149
i2c_clk_freq = 400;

0 commit comments

Comments
 (0)