Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82f29356 authored by Hemant Kumar's avatar Hemant Kumar
Browse files

usb: gadget: f_mass_storage: Allow USB LPM upon ep disable



Upon cable disconnect, there is a possibility of USB LPM
before file-storage thread run to completion. This causes
ep dequeue to fail and results into thread to block for
ever. Prevent this situation by incrementing power usage
count on gadget parent upon ep enable and decrement it
upon ep disable and allow USB LPM after that.

Change-Id: Ic3633320de6ebef912bdaeac305b3dd0df3eb8e0
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent f44d9e36
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -2289,8 +2289,11 @@ reset:
	}

	common->running = 0;
	if (!new_fsg || rc)
	if (!new_fsg || rc) {
		/* allow usb LPM after eps are disabled */
		usb_gadget_autopm_put_async(common->gadget);
		return rc;
	}

	common->fsg = new_fsg;
	fsg = common->fsg;
@@ -2333,6 +2336,9 @@ reset:
		bh->outreq->complete = bulk_out_complete;
	}

	/* prevents usb LPM until thread runs to completion */
	usb_gadget_autopm_get_noresume(common->gadget);

	common->running = 1;
	for (i = 0; i < ARRAY_SIZE(common->luns); ++i)
		if (common->luns[i])