[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZR6pZ5R14xHkW3zT@kernel.org>
Date: Thu, 5 Oct 2023 14:17:43 +0200
From: Simon Horman <horms@...nel.org>
To: Douglas Anderson <dianders@...omium.org>
Cc: Jakub Kicinski <kuba@...nel.org>,
Hayes Wang <hayeswang@...ltek.com>,
"David S . Miller" <davem@...emloft.net>,
linux-usb@...r.kernel.org, Alan Stern <stern@...land.harvard.edu>,
Grant Grundler <grundler@...omium.org>,
Edward Hill <ecgh@...omium.org>,
Bjørn Mork <bjorn@...k.no>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH v2 5/5] r8152: Block future register access if register
access fails
On Wed, Oct 04, 2023 at 12:24:42PM -0700, Douglas Anderson wrote:
...
> @@ -9784,7 +9904,29 @@ static int rtl8152_probe(struct usb_interface *intf,
> else
> device_set_wakeup_enable(&udev->dev, false);
>
> - netif_info(tp, probe, netdev, "%s\n", DRIVER_VERSION);
> + mutex_lock(&tp->control);
> + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) {
> + /* If the device is marked inaccessible before probe even
> + * finished then one of two things happened. Either we got a
> + * USB error during probe or the user already unplugged the
> + * device.
> + *
> + * If we got a USB error during probe then we skipped doing a
> + * reset in r8152_control_msg() and deferred it to here. This
> + * is because the queued reset will give up after 1 second
> + * (see usb_lock_device_for_reset()) and we want to make sure
> + * that we queue things up right before probe finishes.
> + *
> + * If the user already unplugged the device then the USB
> + * farmework will call unbind right away for us. The extra
Hi Douglas,
As you are planning to re-spin anyway: farmework -> framework
> + * reset we queue up here will be harmless.
> + */
> + usb_queue_reset_device(tp->intf);
> + } else {
> + set_bit(PROBED_WITH_NO_ERRORS, &tp->flags);
> + netif_info(tp, probe, netdev, "%s\n", DRIVER_VERSION);
> + }
> + mutex_unlock(&tp->control);
>
> return 0;
>
> --
> 2.42.0.582.g8ccd20d70d-goog
>
Powered by blists - more mailing lists