linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Douglas Anderson <dianders@chromium.org>
Cc: "Jakub Kicinski" <kuba@kernel.org>,
	"Hayes Wang" <hayeswang@realtek.com>,
	"David S . Miller" <davem@davemloft.net>,
	linux-usb@vger.kernel.org,
	"Alan Stern" <stern@rowland.harvard.edu>,
	"Grant Grundler" <grundler@chromium.org>,
	"Edward Hill" <ecgh@chromium.org>, "Bjørn Mork" <bjorn@mork.no>,
	"Eric Dumazet" <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v2 5/5] r8152: Block future register access if register access fails
Date: Thu, 5 Oct 2023 14:17:43 +0200	[thread overview]
Message-ID: <ZR6pZ5R14xHkW3zT@kernel.org> (raw)
In-Reply-To: <20231004122435.v2.5.Ib2affdbfdc2527aaeef9b46d4f23f7c04147faeb@changeid>

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
> 

      parent reply	other threads:[~2023-10-05 12:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-04 19:24 [PATCH v2 0/5] r8152: Avoid writing garbage to the adapter's registers Douglas Anderson
2023-10-04 19:24 ` [PATCH v2 1/5] r8152: Increase USB control msg timeout to 5000ms as per spec Douglas Anderson
2023-10-04 19:24 ` [PATCH v2 2/5] r8152: Check for unplug in rtl_phy_patch_request() Douglas Anderson
2023-10-04 19:24 ` [PATCH v2 3/5] r8152: Check for unplug in r8153b_ups_en() / r8153c_ups_en() Douglas Anderson
2023-10-04 19:24 ` [PATCH v2 4/5] r8152: Rename RTL8152_UNPLUG to RTL8152_INACCESSIBLE Douglas Anderson
2023-10-04 19:24 ` [PATCH v2 5/5] r8152: Block future register access if register access fails Douglas Anderson
2023-10-04 20:12   ` Doug Anderson
2023-10-05 12:17   ` Simon Horman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZR6pZ5R14xHkW3zT@kernel.org \
    --to=horms@kernel.org \
    --cc=bjorn@mork.no \
    --cc=davem@davemloft.net \
    --cc=dianders@chromium.org \
    --cc=ecgh@chromium.org \
    --cc=edumazet@google.com \
    --cc=grundler@chromium.org \
    --cc=hayeswang@realtek.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).