Message ID | 20220406032307.4001281-1-gavin@matician.com |
---|---|
State | New |
Headers | show |
Series | HID: mcp2221: fix hang on probe while setting up gpiochip | expand |
diff --git a/drivers/hid/hid-mcp2221.c b/drivers/hid/hid-mcp2221.c index 4211b9839209b..567ef8b93376d 100644 --- a/drivers/hid/hid-mcp2221.c +++ b/drivers/hid/hid-mcp2221.c @@ -877,6 +877,9 @@ static int mcp2221_probe(struct hid_device *hdev, } i2c_set_adapdata(&mcp->adapter, mcp); + /* gpiolib calls get_direction(), so become ready to process events */ + hid_device_io_start(hdev); + /* Setup GPIO chip */ mcp->gc = devm_kzalloc(&hdev->dev, sizeof(*mcp->gc), GFP_KERNEL); if (!mcp->gc) { @@ -902,6 +905,7 @@ static int mcp2221_probe(struct hid_device *hdev, return 0; err_gc: + hid_device_io_stop(hdev); i2c_del_adapter(&mcp->adapter); err_i2c: hid_hw_close(mcp->hdev);