On Wed, Mar 08, 2023 at 01:54:15PM +0800, Linyu Yuan wrote: > > On 3/4/2023 12:05 AM, Alan Stern wrote: > > On Fri, Mar 03, 2023 at 05:28:38PM +0800, Linyu Yuan wrote: > > > When start probe hub, during INIT, INTT2, INIT3 stage, when link state > > > change to inactive, currently it will reset the device, maybe it will > > > trigger warning in usb_submit_urb() due to urb->hcpriv is still active. > > You need to explain this in much greater detail. > > > > What will reset the device? > > > > What is the code path for this reset? > > will share more code path. > > > > > > Why will urb->hcpriv still be active? > > > still can't explain, that's why add patch#1 to get more urb infol > > > > > Add a flag name init_stage to avoid reset the device. > > Why do you want to avoid resetting the device? > > > at INIT stage, external hub still under enumeration process, i think there > is no need to reset. > > > > > > Doesn't the reset code already include a check for whether the device is > > disconnected? > > > the problem is port is inactive state, but device still in software connect > state, > > there is no disconnect check in reset code. > > > > > > > Signed-off-by: Linyu Yuan <quic_linyyuan@xxxxxxxxxxx> > > > --- > > > @@ -5699,7 +5716,8 @@ static void port_event(struct usb_hub *hub, int port1) > > > dev_dbg(&port_dev->dev, "do warm reset, full device\n"); > > > usb_unlock_port(port_dev); > > > usb_lock_device(udev); > > > - usb_reset_device(udev); > > > + if (!port_child_avoid_reset(udev)) > > > + usb_reset_device(udev); > > > usb_unlock_device(udev); > > Doesn't usb_lock_device() already prevent this code from running during > > the INIT, INIT2, and INIT3 stages of hub preparation? > > > as it use some delay worker to complete the INIT stage, as i know it will > not lock device > > when worker is not start. > > do you have any better suggestion about this point ? I can't offer any suggestions because I don't understand the problem you want to fix, or how your patch is meant to work. Alan Stern