Message ID | 20231020140655.v5.6.I6405b1587446c157c6d6263957571f2b11f330a7@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 fe16csp1325708vqb; Fri, 20 Oct 2023 14:09:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHZLaP/IgDAayomzzmFJDcrVkqFS+nLQtvaChOYX175mg/x3tRh48iVpvkrw+iDy7Mfbgde X-Received: by 2002:a17:903:22c5:b0:1c4:5e9e:7865 with SMTP id y5-20020a17090322c500b001c45e9e7865mr3367528plg.0.1697836161872; Fri, 20 Oct 2023 14:09:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697836161; cv=none; d=google.com; s=arc-20160816; b=jColho3uY8ULuA+9zCtNV4stHJA3a74RA/8n2t9DCbOeW0MOjHpyY7TtLDXAKPNxSv DELi71nyku3vXM9ZgElJ/nY8hePkNNsg9utoS95lTuA7LH1vrIuPr+1SV2x64KtN0RH6 jLrt7I0qrTK0LotMSNRs3nBZrRNkoHf64lbTJ0MdZWANFQ7kRxjaPhk0ySGMFYonoFHP E+dY3Bm4DlyA1swUT2Ky0gZIuuznJ3WLCkTykgB/hI6aaTErl1qUrrORTZ3aAIjtDrGl eNgysw3xNwAHjaM0GGAxCAGGtS6jKyogeiudXoKzFe7WTAC57xKe/j7VL2/ElS1A8vzA ztdg== 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=CQE73OQ0b8iyTRPhBZA90MrBZY63bSWJ7tj6pb5onnk=; fh=zTr+uH2kSs/oKblpwigKoDAJbZw82uLZilNO8W1q+qc=; b=yzJ593D00OH0zDz9IREnK6/u8LbgglJW/O1MhhBbRZMmes0JPqVqINVDXkRcVaDRTJ qIZ6tRirlsm/5+czkpsC1uCYr1YQaosrfUbUFCyjAviTR7Hwahon2INXeLQ5ZQ/AhGkj AhcWj65je3FTGNqOWe3heM/ky3OH9KPLk2nqB/Gh7NCXTyFSFGJj1LsLzNnAYX8933eP JYQ6gfK2m0rtGhzIU/5Wfl8yvNRnOgrwuepws9q92Y2g5a4UmOPf2dZANL5mLO+9AKKK dKbSqexCLsSAdC7Gx8JZk05CkefIJmL2doYgt0x90DDwMHNfbBijwCjDrbldfc07Kazz l2Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="C/wcTvjn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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. [23.128.96.36]) by mx.google.com with ESMTPS id h18-20020a170902f55200b001c9ca0167e2si2709473plf.420.2023.10.20.14.09.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 14:09:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="C/wcTvjn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 C5BA983A296E; Fri, 20 Oct 2023 14:09:16 -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 S233197AbjJTVIo (ORCPT <rfc822;a1648639935@gmail.com> + 26 others); Fri, 20 Oct 2023 17:08:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232860AbjJTVIZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 20 Oct 2023 17:08:25 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A92F10E7 for <linux-kernel@vger.kernel.org>; Fri, 20 Oct 2023 14:08:21 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6b20577ef7bso1129843b3a.3 for <linux-kernel@vger.kernel.org>; Fri, 20 Oct 2023 14:08:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1697836101; x=1698440901; 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=CQE73OQ0b8iyTRPhBZA90MrBZY63bSWJ7tj6pb5onnk=; b=C/wcTvjnhoKLAEVBZozgEwzY0xA/DkFBe0ny+6jN4qe9QGLfpf2hviHQQJGhx/UwZG SbMuv+PwCsEZ0nE9UHj418jXDtYUzQGxl5kfHTui68brDAHYidm8qVqNWMy1GMppu9ab F5wbVyrqwr8nfkCgN1M33E/s+MjSR5BA01gyQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697836101; x=1698440901; 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=CQE73OQ0b8iyTRPhBZA90MrBZY63bSWJ7tj6pb5onnk=; b=wjqxJ4Rusw//gQqxtndyb0pjVi/32RTc+vB9G5GXnhm99SaRFKdZ8GrmVGjl0ObzQI VJ1VglDbArUmGo+l1ZSJx7CBkN9kih/9YaoWhlngg/+6/vaoHTnOEZ3OgkJrT3kJLDhn EQAhwCtglmZHSJ8uw/D6AjUAVrJSfy/p8w3Hy3OJgOG7oVKfSluJEmMQKVxg706wulpU CgCInY0+SC9n6OeHWV3AlYI4xWhxtWru2MWNxp9MrTW3vSX1NzLL3BhhccvWNWFepPtk uF3/t4LANh+SE1UqOvSFTDbRORYsjwJl8QR2zu05IJsKEnVcYSORUYBWgJv0ehOL4zbD werQ== X-Gm-Message-State: AOJu0Yw2xTn5LC2B5mMCuca/AQHl+HDiaJmofPCyQU/9Wd8Xzf2j0+/c FdARaTLGGJc9zgk4lVmfxJI+yQ== X-Received: by 2002:a05:6a20:3c8b:b0:15d:9ee7:180a with SMTP id b11-20020a056a203c8b00b0015d9ee7180amr3042099pzj.4.1697836100885; Fri, 20 Oct 2023 14:08:20 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 14:08:20 -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 6/8] r8152: Check for unplug in r8153b_ups_en() / r8153c_ups_en() Date: Fri, 20 Oct 2023 14:06:57 -0700 Message-ID: <20231020140655.v5.6.I6405b1587446c157c6d6263957571f2b11f330a7@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:09:16 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780310251280522494 X-GMAIL-MSGID: 1780310251280522494 |
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 r8153b_ups_en() /
r8153c_ups_en() we could end up looping for 10 seconds (20 ms * 500
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 r8153b_ups_en() / r8153c_ups_en()") new for v2.
drivers/net/usb/r8152.c | 4 ++++
1 file changed, 4 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 r8153b_ups_en() / > r8153c_ups_en() we could end up looping for 10 seconds (20 ms * 500 > 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 r8153b_ups_en() / r8153c_ups_en()") new for v2. > > drivers/net/usb/r8152.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c > index 9888bc43e903..982f9ca03e7a 100644 > --- a/drivers/net/usb/r8152.c > +++ b/drivers/net/usb/r8152.c > @@ -3663,6 +3663,8 @@ static void r8153b_ups_en(struct r8152 *tp, bool enable) > int i; > > for (i = 0; i < 500; i++) { > + if (test_bit(RTL8152_UNPLUG, &tp->flags)) > + return; > if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) & > AUTOLOAD_DONE) > break; > @@ -3703,6 +3705,8 @@ static void r8153c_ups_en(struct r8152 *tp, bool enable) > int i; > > for (i = 0; i < 500; i++) { > + if (test_bit(RTL8152_UNPLUG, &tp->flags)) > + return; > if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) & > AUTOLOAD_DONE) > break; > -- > 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 r8153b_ups_en() / > r8153c_ups_en() we could end up looping for 10 seconds (20 ms * 500 > 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 9888bc43e903..982f9ca03e7a 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -3663,6 +3663,8 @@ static void r8153b_ups_en(struct r8152 *tp, bool enable) int i; for (i = 0; i < 500; i++) { + if (test_bit(RTL8152_UNPLUG, &tp->flags)) + return; if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) & AUTOLOAD_DONE) break; @@ -3703,6 +3705,8 @@ static void r8153c_ups_en(struct r8152 *tp, bool enable) int i; for (i = 0; i < 500; i++) { + if (test_bit(RTL8152_UNPLUG, &tp->flags)) + return; if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) & AUTOLOAD_DONE) break;