Message ID | 20231020140655.v5.5.I300ed6c3269c77756bdd10dd0d6f97db85470186@changeid |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp1325607vqb; Fri, 20 Oct 2023 14:09:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEofZcftQomB6aRNkqmiKwZ180JhuSzWRD6vqJfkxdETyWDumNeHC4wsfpSfaL3IcIS779 X-Received: by 2002:a17:90a:7e87:b0:268:5575:93d9 with SMTP id j7-20020a17090a7e8700b00268557593d9mr3269715pjl.10.1697836148163; Fri, 20 Oct 2023 14:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697836148; cv=none; d=google.com; s=arc-20160816; b=gIf0N8/vCBZUSnwRAJaIaioa82WkwiIpdjW3NMjZwANBbB+g8s0Z66YYRyUSwvh7Mo OpZS7u/528P30De2S1D3pgQ+ytjQO9ncuYt0+wbgwRSQyBWN7uZK6UaX3ZAOFTY1gJMg 7XlUGTHhfbITRFI6wt9GKFqKsUod9P4lWwIHwyUtgydbNCSOXQstDVswWLerDUY5EFzo x5yDUTzCp8lPEkfR4Dl4UtOYkT9Mb2UltR5nRBS3xtkSgnV9m/iOYnoktE3TWrp39aFp EQtzQWNX/5kGWzr4ozfAjU3nZZ/+NhewWBMjl11RpnibkCkoWyjEwsYChmL3tsLtTjtc 5j7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bAHIdwVQAiU7foM+hKZA1xP7duO0xSFXmMfBzAEr0JE=; fh=zTr+uH2kSs/oKblpwigKoDAJbZw82uLZilNO8W1q+qc=; b=wPstH3+uZUODtWbxgSpKrUupnPH6KAlLLEFzg2dhlVLTeLtbtfFpmQWUe50qaJa7wm NJB0oLQY6BqwoECD80c/jD3z22RhBiMiWIZs8OprSz1KbdXE8ztSCLa//VTuMRh36e4k 4UkU+S+3gPYQWj1TNZgWIz8Mz2B79XLRf0jYTw5JSkOV1cM1T37NC6613qFrIIIJ3wO7 P++x3iuD7o3UQ0v88RwDlp/AQxKY2vqGBdxtSkJsnkAOGF7fV4wLS2ucAozNu1XJtV/u qwcyk+6J7e0i8u2jNDOjmoRWOm6sXvktgVKJWj1EACAkCyR/lTSh9CUz2rGNaPPZuAep Ro+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jjPP0R+Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id pc7-20020a17090b3b8700b00279435d74d8si5445298pjb.135.2023.10.20.14.09.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 14:09:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jjPP0R+Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 921F483D9B64; Fri, 20 Oct 2023 14:08:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233186AbjJTVIk (ORCPT <rfc822;a1648639935@gmail.com> + 26 others); Fri, 20 Oct 2023 17:08:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232710AbjJTVIY (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 20 Oct 2023 17:08:24 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A837E10D4 for <linux-kernel@vger.kernel.org>; Fri, 20 Oct 2023 14:08:19 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6b36e1fcee9so1253929b3a.3 for <linux-kernel@vger.kernel.org>; Fri, 20 Oct 2023 14:08:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1697836099; x=1698440899; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bAHIdwVQAiU7foM+hKZA1xP7duO0xSFXmMfBzAEr0JE=; b=jjPP0R+Zvip59m9GnAgCjFOC5ZF15TLYAfIkxR04byd7FNrDKaiarIblamhi0ORbje xfpt1fG7hy8ApnKxT/ypaiehvhf0p3bgboxbvPk+hoTbhr/9w3u+w6Ismd0ejkv3FINH YHYzi0dF3D+B6L+LL2jSO0ht1U6tbHLAShq64= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697836099; x=1698440899; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bAHIdwVQAiU7foM+hKZA1xP7duO0xSFXmMfBzAEr0JE=; b=wFD4rtEE4xneJGPl3nES1yaOZOAFZC3pHHvvJnSUChn71Ujhf8EIOOI45LULvqJDXn qXo/uYj3OPeGOtPtXEH3mQsh2F6329L9kFBBHGMsHW7iPNr4mFLsPsIAFUDVTewyhB8s p7OLKEAQZR2H66an9nOu7CBGyVCQFg0eH04adRI2/u1uLsvuoXpuqFcN0vmpfNdAMcO1 rckkr68uXEJp0Y3Ifu4T17GjsFU9q27aVKXwzCT0+DLgDmcHcQnZktY978Tgyz+TGaSz u/GXwYCELbkfcTKkt81rT+pyZSHXJZSZlUCrrt+nWcye1YAP8qu34F7o0oB3e8tvqzY4 5p3A== X-Gm-Message-State: AOJu0YwfAE81VI7Bq/yqelnun4ZnQZ0EvnWJWAW+4I+3Ku10YXUM4LNn ge8ox4SUHiy+uEDpIc3jX9PolQ== X-Received: by 2002:a05:6a00:1402:b0:693:3851:bd3e with SMTP id l2-20020a056a00140200b006933851bd3emr3272815pfu.3.1697836099153; Fri, 20 Oct 2023 14:08:19 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:c078:ee4f:479f:8486]) by smtp.gmail.com with ESMTPSA id w14-20020aa7954e000000b00686b649cdd0sm1969278pfq.86.2023.10.20.14.08.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 14:08:18 -0700 (PDT) From: Douglas Anderson <dianders@chromium.org> To: Jakub Kicinski <kuba@kernel.org>, Hayes Wang <hayeswang@realtek.com>, "David S . Miller" <davem@davemloft.net> Cc: Edward Hill <ecgh@chromium.org>, Laura Nao <laura.nao@collabora.com>, Alan Stern <stern@rowland.harvard.edu>, Simon Horman <horms@kernel.org>, linux-usb@vger.kernel.org, Grant Grundler <grundler@chromium.org>, Douglas Anderson <dianders@chromium.org>, =?utf-8?q?Bj=C3=B8rn_Mork?= <bjorn@mork.no>, Eric Dumazet <edumazet@google.com>, Paolo Abeni <pabeni@redhat.com>, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v5 5/8] r8152: Check for unplug in rtl_phy_patch_request() Date: Fri, 20 Oct 2023 14:06:56 -0700 Message-ID: <20231020140655.v5.5.I300ed6c3269c77756bdd10dd0d6f97db85470186@changeid> X-Mailer: git-send-email 2.42.0.758.gaed0368e0e-goog In-Reply-To: <20231020210751.3415723-1-dianders@chromium.org> References: <20231020210751.3415723-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 20 Oct 2023 14:08:59 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780310236767137104 X-GMAIL-MSGID: 1780310236767137104 |
Series |
r8152: Avoid writing garbage to the adapter's registers
|
|
Commit Message
Doug Anderson
Oct. 20, 2023, 9:06 p.m. UTC
If the adapter is unplugged while we're looping in
rtl_phy_patch_request() we could end up looping for 10 seconds (2 ms *
5000 loops). Add code similar to what's done in other places in the
driver to check for unplug and bail.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
(no changes since v2)
Changes in v2:
- ("Check for unplug in rtl_phy_patch_request()") new for v2.
drivers/net/usb/r8152.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On Fri, Oct 20, 2023 at 2:08 PM Douglas Anderson <dianders@chromium.org> wrote: > > If the adapter is unplugged while we're looping in > rtl_phy_patch_request() we could end up looping for 10 seconds (2 ms * > 5000 loops). Add code similar to what's done in other places in the > driver to check for unplug and bail. > > Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Grant Grundler <grundler@chromium.org> > --- > > (no changes since v2) > > Changes in v2: > - ("Check for unplug in rtl_phy_patch_request()") new for v2. > > drivers/net/usb/r8152.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c > index 656fe90734fc..9888bc43e903 100644 > --- a/drivers/net/usb/r8152.c > +++ b/drivers/net/usb/r8152.c > @@ -4046,6 +4046,9 @@ static int rtl_phy_patch_request(struct r8152 *tp, bool request, bool wait) > for (i = 0; wait && i < 5000; i++) { > u32 ocp_data; > > + if (test_bit(RTL8152_UNPLUG, &tp->flags)) > + break; > + > usleep_range(1000, 2000); > ocp_data = ocp_reg_read(tp, OCP_PHY_PATCH_STAT); > if ((ocp_data & PATCH_READY) ^ check) > -- > 2.42.0.758.gaed0368e0e-goog >
On 10/20/2023 2:06 PM, Douglas Anderson wrote: > If the adapter is unplugged while we're looping in > rtl_phy_patch_request() we could end up looping for 10 seconds (2 ms * > 5000 loops). Add code similar to what's done in other places in the > driver to check for unplug and bail. > > Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 656fe90734fc..9888bc43e903 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -4046,6 +4046,9 @@ static int rtl_phy_patch_request(struct r8152 *tp, bool request, bool wait) for (i = 0; wait && i < 5000; i++) { u32 ocp_data; + if (test_bit(RTL8152_UNPLUG, &tp->flags)) + break; + usleep_range(1000, 2000); ocp_data = ocp_reg_read(tp, OCP_PHY_PATCH_STAT); if ((ocp_data & PATCH_READY) ^ check)