Message ID | 20231019142019.v4.3.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 fe16csp659599vqb; Thu, 19 Oct 2023 14:24:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE059v14/b4UzcW7HTkpdzMC9wVDQVuQEqCHiYj3glgJrfaOnYYndtruxwEKYXS2WE7mbyk X-Received: by 2002:a17:902:f104:b0:1c9:dff1:6ded with SMTP id e4-20020a170902f10400b001c9dff16dedmr88013plb.1.1697750643174; Thu, 19 Oct 2023 14:24:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697750643; cv=none; d=google.com; s=arc-20160816; b=qIGMnO1LYcLMEzCiYYZIbG3AlVOH+gzNhNHcoaFn87nH7PuHQ3s9lmF/EAbQHMmwgN nrmu+K+ClIgNzCMTJgNgCCZ/fUXIn4Eu0oXZevtGZdk+9CKJ3AUpYfsJGmyayG2uO5C7 TB+uzgptwuXMtDZYVnSM2MmKhSWeoPq/OqPsaf2uf1d5blGH/0qzpmsKfGsw8GfvQfCK 55hRaAQXx3YOI3sc5ATyRrVlQh7Hs9wrN5CR5/0eW2xGrQESVrW5Knrgm9htIhYPqlLh U5PB5XBbNS/tT3VLDFiOg6ItIPXnARRsYjxIg0iUjgebPbT4DCgoKcQ/uJxCfCrRCH4D 4Kmw== 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=h2Zb52xqU9YG10pBRwWVILZJr4eqiLRUY7pMspVelCk=; fh=iQz8TR/TEhrJ65P6O6F77LKl82gG554r6Y3izUu7t+g=; b=nS/9wot+kSaon3v/k3PyiCcqsNq3yL9iQeJQOeZ9Lo3mMgawCS4+tjSIoWCpSXIEe6 v27DQypjZJKXQntDgVUaCfyMFBdmM4kSwIMjRX6e10+ysqKisJqbnAEdlqSgG05/hu0o A8c/fPSin4xmyXphwXqlUgPOtr5Px7W7jMWgS1lEgvaXKXK504Zox8bVI/9Gdmc+5hyh L/gounB4GhDwBZSxBD1EMeKW67GU2hmvIgyl7hrMXrpkx2APDVUIWEmWF5lX0ySuJ5Hj EZVcY+IAjOh4moIaaxUHuKxpcRPA4447WInMScAZODJoOdxARqtN95gCJKzfr3svJDAU SSEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hNgF4d53; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id m15-20020a170902db0f00b001b8a4954be1si391738plx.595.2023.10.19.14.24.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 14:24:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hNgF4d53; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id BF5A380756E9; Thu, 19 Oct 2023 14:23:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346668AbjJSVXG (ORCPT <rfc822;a1648639935@gmail.com> + 26 others); Thu, 19 Oct 2023 17:23:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235612AbjJSVWm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 19 Oct 2023 17:22:42 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F3DB1705 for <linux-kernel@vger.kernel.org>; Thu, 19 Oct 2023 14:22:01 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1c9bca1d96cso831715ad.3 for <linux-kernel@vger.kernel.org>; Thu, 19 Oct 2023 14:22:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1697750520; x=1698355320; 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=h2Zb52xqU9YG10pBRwWVILZJr4eqiLRUY7pMspVelCk=; b=hNgF4d53t1HA2mDAiAdDE9c9nVJHEPGUZqHkg3NeHxn85laVdDehQK9z1ycwLxQODN DTbMmL7wVWQPGP1lf4hmtWN2yK4Kw/heKkSVi9tOSafCbRZYGwECPErqE1CKz53oDK16 3w4MmJyur+WiKN0nEPaNo9wouRRPAAeD0z34o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697750520; x=1698355320; 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=h2Zb52xqU9YG10pBRwWVILZJr4eqiLRUY7pMspVelCk=; b=NRvELA/pu12G5/TAxfkTW98e1emM0kEgdgxMVreYx5tZHmZjfIpcnvEynFdV1wmqud jrkAmBuuJfvEJo02GKkTu4ZWlSXTw5PkHHhjf9+yUGLgFY7A8UeRGOO6Em1c0humUqsC orNL0KkwT0ZGq9EcBkVvOcqP8JfwLiUTMVs7ptyVyins7HrhQk8yFo4/lFiRA0dhsyWO 6g3eVUdBm0nqBoJAi6R9xfRYuLYUzVFpX96CUdmx6bDYKUaXnOaX8W9NIHe4j6rjzubi ouB6MnMDWvYzscdqXtuB5UVFbbu6jOCmGe38GCH2jyAT3OQwiNW+bcDavcBTt4FS04+i /3TA== X-Gm-Message-State: AOJu0YxhKOLzCQ5KzrRCDZYaU2BYRGxL3ZyZwJh6E7Rui0KvMrUXJmg5 6x5IawIOfyDbZ6TFG82ONFvJ3CV2awtgId2CP/vt2w== X-Received: by 2002:a17:902:d492:b0:1b2:4852:9a5f with SMTP id c18-20020a170902d49200b001b248529a5fmr59681plg.54.1697750520517; Thu, 19 Oct 2023 14:22:00 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:a6da:6f08:412:e04b]) by smtp.gmail.com with ESMTPSA id l2-20020a170902d34200b001bbdd44bbb6sm154100plk.136.2023.10.19.14.21.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 14:21:59 -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: Grant Grundler <grundler@chromium.org>, Edward Hill <ecgh@chromium.org>, linux-usb@vger.kernel.org, Simon Horman <horms@kernel.org>, Laura Nao <laura.nao@collabora.com>, Alan Stern <stern@rowland.harvard.edu>, 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 v4 3/5] r8152: Check for unplug in r8153b_ups_en() / r8153c_ups_en() Date: Thu, 19 Oct 2023 14:20:22 -0700 Message-ID: <20231019142019.v4.3.I6405b1587446c157c6d6263957571f2b11f330a7@changeid> X-Mailer: git-send-email 2.42.0.758.gaed0368e0e-goog In-Reply-To: <20231019212130.3146151-1-dianders@chromium.org> References: <20231019212130.3146151-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 howler.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 (howler.vger.email [0.0.0.0]); Thu, 19 Oct 2023 14:23:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780220577922926404 X-GMAIL-MSGID: 1780220577922926404 |
Series |
r8152: Avoid writing garbage to the adapter's registers
|
|
Commit Message
Doug Anderson
Oct. 19, 2023, 9:20 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(+)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index fff2f9e67b5f..888d3884821e 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;