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

Commit b51baac1 authored by Azhar Shaikh's avatar Azhar Shaikh Committed by Matt Wagantall
Browse files

USB: android: Schedule work only if suspended variable is changed



currently as part of USB link status change event for U3 -> U0,
DWC3 controller driver is not calling driver resume. This results
in not updating suspended status in composite layer due to which
disconnect, configured and then disconnect events are sent to userspace.
This might cause problems for some userspace applications. Hence handle
USB link status event for resume by reverting the commit b217f5007d
("USB: dwc3: Don't handle USB/Link Status change event for RESUME").
Fix actual issue of disconnect sent during suspend/resume in android.c
by scheduling work only if the suspended status is changed to notify
userspace.

CRs-Fixed: 569639
Change-Id: If4fe6f3e8087d3bc972705ff40e4f94f597e2d09
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: default avatarAzhar Shaikh <azhars@codeaurora.org>
parent b9be963b
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -3572,8 +3572,10 @@ static void android_suspend(struct usb_gadget *gadget)
	unsigned long flags;

	spin_lock_irqsave(&cdev->lock, flags);
	if (!dev->suspended) {
		dev->suspended = 1;
		schedule_work(&dev->work);
	}
	spin_unlock_irqrestore(&cdev->lock, flags);

	composite_suspend_func(gadget);
@@ -3586,8 +3588,10 @@ static void android_resume(struct usb_gadget *gadget)
	unsigned long flags;

	spin_lock_irqsave(&cdev->lock, flags);
	if (dev->suspended) {
		dev->suspended = 0;
		schedule_work(&dev->work);
	}
	spin_unlock_irqrestore(&cdev->lock, flags);

	composite_resume_func(gadget);