RE: [PATCH REPOST net-next 1/2] r8152: If inaccessible at resume time, issue a reset
From: Hayes Wang
Date: Mon Jun 03 2024 - 02:41:22 EST
Douglas Anderson <dianders@xxxxxxxxxxxx>
> Sent: Friday, May 31, 2024 7:43 AM
[...]
> 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@xxxxxxxxxxxx>
Acked-by: Hayes Wang <hayeswang@xxxxxxxxxxx>
Best Regards,
Hayes