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

Commit 2ca83afc authored by Hemant Kumar's avatar Hemant Kumar Committed by Mayank Rana
Browse files

usb: f_fs: Prevent gadget unbind if it is already unbound



Upon usb composition switch there is possibility of ep0 file
release happening after gadget driver bind. In case of composition
switch from adb to a non-adb composition gadget will never gets
bound again resulting into failure of usb device enumeration. Fix
this issue by checking FFS_FL_BOUND flag and avoid extra
gadget driver unbind if it is already done as part of composition
switch.

Change-Id: I1638001ff4a94f08224b188aa42425f3d732fa2b
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent 8e42e641
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -4060,10 +4060,11 @@ static void ffs_closed(struct ffs_data *ffs)

	ffs_dev_unlock();

	if (test_bit(FFS_FL_BOUND, &ffs->flags)) {
		unregister_gadget_item(opts->
			       func_inst.group.cg_item.ci_parent->ci_parent);

		ffs_log("unreg gadget done");
	}
done:
	ffs_log("exit");
}