Commit b52f2d43 authored by Krishna Kurapati's avatar Krishna Kurapati Committed by Krishna Kurapati PSSNV
Browse files

UPSTREAM: usb: dwc3: gadget: Propagate core init errors to UDC during pullup



In scenarios where pullup relies on resume (get sync) to initialize
the controller and set the run stop bit, then core_init is followed by
gadget_resume which will eventually set run stop bit.

But in cases where the core_init fails, the return value is not sent
back to udc appropriately. So according to UDC the controller has
started but in reality we never set the run stop bit.

On systems like Android, there are uevents sent to HAL depending on
whether the configfs_bind / configfs_disconnect were invoked. In the
above mentioned scnenario, if the core init fails, the run stop won't
be set and the cable plug-out won't result in generation of any
disconnect event and userspace would never get any uevent regarding
cable plug out and we never call pullup(0) again. Furthermore none of
the next Plug-In/Plug-Out's would be known to configfs.

Return back the appropriate result to UDC to let the userspace/
configfs know that the pullup failed so they can take appropriate
action.

Fixes: 77adb8bd ("usb: dwc3: gadget: Allow runtime suspend if UDC unbinded")
Cc: stable <stable@kernel.org>
Change-Id: Ieb281722cdc4fa2ff15545d9edaabdc8c2d70223
Signed-off-by: default avatarKrishna Kurapati <quic_kriskura@quicinc.com>
Acked-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
Message-ID: <20230618120949.14868-1-quic_kriskura@quicinc.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit c0aabed9
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

 master)

Bug: 289984280
Change-Id: I633b2c325dd954a3e4cdd636052158a90fd976a3
Signed-off-by: default avatarKrishna Kurapati <quic_kriskura@quicinc.com>
parent 505b4a19
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment