diff options
author | Ajay Agarwal <ajaya@codeaurora.org> | 2017-04-11 12:43:56 +0530 |
---|---|---|
committer | Ajay Agarwal <ajaya@codeaurora.org> | 2017-04-12 15:43:42 +0530 |
commit | 61add90b905cda22bdd98f743bda7738247bb2f2 (patch) | |
tree | b1a70b50e1713af3c534354ddd2feceaa92ac705 | |
parent | a3851309dbf7e919b27e2ec927ba3f6350347dff (diff) |
usb: gadget: ffs: Fix runtime PM usage count for multiple set_alt
In some scenarios such as USBCV tests, multiple set_alt
could be issued with same interface and alternate
setting. In that case, EPs are disabled and enabled,
we get the usage count but do not put it. This causes
a mismatch and DWC3 LPM does not work anymore. Fix
this issue by moving put_usage_count to ffs_func_set_alt.
Change-Id: Ic85db09820d2c18b67bd463fe27e2c1ef41e8c74
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
-rw-r--r-- | drivers/usb/gadget/function/f_fs.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index a1c00525a598..7224ba589771 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -1159,7 +1159,7 @@ static ssize_t ffs_epfile_read_iter(struct kiocb *kiocb, struct iov_iter *to) *to = p->data; } - ffs_log("enter"); + ffs_log("exit"); return res; } @@ -3354,6 +3354,8 @@ static int ffs_func_set_alt(struct usb_function *f, if (ffs->func) { ffs_func_eps_disable(ffs->func); ffs->func = NULL; + /* matching put to allow LPM on disconnect */ + usb_gadget_autopm_put_async(ffs->gadget); } if (ffs->state == FFS_DEACTIVATED) { @@ -3387,14 +3389,9 @@ static int ffs_func_set_alt(struct usb_function *f, 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_log("enter"); ffs_func_set_alt(f, 0, (unsigned)-1); - /* matching put to allow LPM on disconnect */ - usb_gadget_autopm_put_async(ffs->gadget); ffs_log("exit"); } |