UPSTREAM: usb: gadget: f_mass_storage: Disable eps during disconnect

When receiving a disconnect event from the UDC, the mass storage
function driver currently runs the handle_exception() routine
asynchronously.  For UDCs that support runtime PM, there is a
possibility the UDC is already suspended by the time the
do_set_interface() is executed.  This can lead to HW register access
while the UDC is already suspended.

Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>

Bug: 204343836
(cherry picked from commit 9fff139aeb11186fd8e75860c959c86cb43ab2f6)
Change-Id: I6c8011baddf02d6b0eadb5934416bc24b8a93f4a
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
(cherry picked from commit 8c9d9d8e44aa69102ed589e66a55e6ef93b834ef)
This commit is contained in:
Wesley Cheng 2021-10-27 13:00:37 -07:00 committed by Todd Kjos
parent c1993b4cbc
commit 2baf6bfef4
1 changed files with 10 additions and 0 deletions

View File

@ -2269,6 +2269,16 @@ static void fsg_disable(struct usb_function *f)
{
struct fsg_dev *fsg = fsg_from_func(f);
/* Disable the endpoints */
if (fsg->bulk_in_enabled) {
usb_ep_disable(fsg->bulk_in);
fsg->bulk_in_enabled = 0;
}
if (fsg->bulk_out_enabled) {
usb_ep_disable(fsg->bulk_out);
fsg->bulk_out_enabled = 0;
}
__raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE, NULL);
}