]> www.infradead.org Git - users/willy/xarray.git/commit
r8152: If inaccessible at resume time, issue a reset
authorDouglas Anderson <dianders@chromium.org>
Thu, 30 May 2024 23:43:08 +0000 (16:43 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 4 Jun 2024 01:49:10 +0000 (18:49 -0700)
commit4933b066fefbee4f1d2d708de53c4ab7f09026ad
tree0f23e0c06dd762cf121780117c65afc6b32e0120
parent83042ce9b7c39b0e64094d86a70d62392ac21a06
r8152: If inaccessible at resume time, issue a reset

If we happened to get a USB transfer error during the transition to
suspend then the usb_queue_reset_device() that r8152_control_msg()
calls will get dropped on the floor. This is because
usb_lock_device_for_reset() (which usb_queue_reset_device() uses)
silently fails if it's called when a device is suspended or if too
much time passes.

Let's resolve this by resetting the device ourselves in r8152's
resume() function.

NOTE: due to timing, it's _possible_ that we could end up with two USB
resets: the one queued previously and the one called from the resume()
patch. This didn't happen in test cases I ran, though it's conceivably
possible. We can't easily know if this happened since
usb_queue_reset_device() can just silently drop the reset request. In
any case, it's not expected that this is a problem since the two
resets can't run at the same time (because of the device lock) and it
should be OK to reset the device twice. If somehow the double-reset
causes problems we could prevent resets from being queued up while
suspend is running.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Hayes Wang <hayeswang@realtek.com>
Link: https://lore.kernel.org/r/66590f22.170a0220.8b5ad.1750@mx.google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/usb/r8152.c