USB: configfs: Send DISCONNECT uevent during UDC bind

commit ("USB: configfs: Don't send DISCONNECT uevent during unbind")
removed sending disconnect uevent from unbind path. In normal disconnect
path kernel will notify the disconnect event from dwc3_disconnect_gadget()
function. If their is a race between composition switch and cable
disconnect dwc gadget pointers may become null from composition unbind
rules and then we end up not sending any disconnect notification to
usespace and status remains in usb connected state in
usb preferences screen.

Hence fix this issue by scheduling android work from bind path
which will send disconnect event to userspace.

Change-Id: Ic53d8d9f6e5ae19d28bb1c23722a62a38f80ec08
Signed-off-by: Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
This commit is contained in:
Chandana Kishori Chiluveru 2019-06-11 12:38:42 +05:30 • committed by Gerrit - the friendly Code Review server
commit 147ca8205d

View file

@ -323,6 +323,9 @@ static ssize_t gadget_dev_desc_UDC_store(struct config_item *item,
gi->composite.gadget_driver.udc_name = NULL;
goto err;
}
#ifdef CONFIG_USB_CONFIGFS_UEVENT
schedule_work(&gi->work);
#endif
}
mutex_unlock(&gi->lock);
return len;