USB: f_fs: Disable USB LPM on bus_suspend with ADB

ADB function is mainly used for debugging, hence it is
not expected to allow USB LPM followed by system suspend
in device bus suspend. Driver also doesn't handle
usb_ep_dequeue failure in LPM when adbd is interrupted
by signal as buffer is left queued to the hardware after
usb_ep_dequeue failure and can cause memory corruption.

Change-Id: Ib89c80318dcdd0dbb35d122a2ab77fb61f83518e
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
This commit is contained in:
Manu Gautam 2015-12-29 22:25:36 +05:30 committed by David Keitel
parent 0ede2f03b1
commit 3d2c84e2f1

View file

@ -3073,14 +3073,23 @@ static int ffs_func_set_alt(struct usb_function *f,
ffs->func = func;
ret = ffs_func_eps_enable(func);
if (likely(ret >= 0))
if (likely(ret >= 0)) {
ffs_event_add(ffs, FUNCTIONFS_ENABLE);
/* Disable USB LPM later on bus_suspend */
usb_gadget_autopm_get_async(ffs->gadget);
}
return ret;
}
static void ffs_func_disable(struct usb_function *f)
{
struct ffs_function *func = ffs_func_from_usb(f);
struct ffs_data *ffs = func->ffs;
ffs_func_set_alt(f, 0, (unsigned)-1);
/* matching put to allow LPM on disconnect */
usb_gadget_autopm_put_async(ffs->gadget);
}
static int ffs_func_setup(struct usb_function *f,