From patchwork Wed Nov 29 21:25:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 171571 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp628761vqn; Wed, 29 Nov 2023 13:26:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2std9t/DsohbNFyPNaLuqruy5GnwP6Oby4nAzTHSQvFsCEAGN2D9rBRnzYNLVxmMXA+yB X-Received: by 2002:a17:902:ee82:b0:1cc:1490:e7bf with SMTP id a2-20020a170902ee8200b001cc1490e7bfmr21357710pld.30.1701293204327; Wed, 29 Nov 2023 13:26:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701293204; cv=none; d=google.com; s=arc-20160816; b=CsRggMrkgFbXnnXH0JNouslmd3E+h3uLOfT0ihtb+5le9c3TFGB2tSFVtaG3SbP6um Dbpicqb7+PxkCETc+SqVFgoBloYiXOAkDHXKdr6+GkFkg81yD1wPYj/pOqgKNX7RBiyp erYB3WFTJY4di14dZSjzaCQ9uTMxKop5uLILLN8hF7fwfYGR4ErjiAdq2V1PebumIgzI dmJYnWKFTggZ39E3T5z1dxLqp/pl/PsxsEAaVTNeeo8N2rRFLG5BKxLJf39RM0fWqDhR drzUvAdlau0pD8WuQqkY/BMv0T5pEjmus6L+C88JOCq6WpCgAatdPdw0Lkb/z0suPZKv toBA== 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=oMcpqMy/WvMvoKWfDIGBKOAFuUqj17oPCULwBqejJlE=; fh=mRHaPBoaK/yKIiTe7zbQTMuaXdIOIrIp8KgHhHuSvhs=; b=lmpDfgRbhucfcgORhx/qFRHlq3X8vcfQcORp5gCKYj8e8TfXrNi4CvBUmKccU+B4Jn XpclEDuh036+pO+eVP9mfjVqErcblEF8XOJwVYoE+o7R7DCWEjS/24eKg+J0AjFpjVwb yR9SODfFcVnvvDxlMrRdlzCB8wbQA0z33d0v9gmPbw9q3+0u9aNwFeZj1PqjfoNhKfDg DBD8+CwrJ/LDpi7s7e9T3B48pC/a64/T6cIamFWL6+eQGmpXQtHo0Vr64h+z9qbrCQcF DoM063uGKMGEoXpWvlY3xJz8hyFr3LKR5wjPf89GAizwhYDvUGXHyGCl8gBjxh65EAKf nfFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=C4lVJORK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id f15-20020a170902ce8f00b001cfaf05da38si12700065plg.58.2023.11.29.13.26.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 13:26:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=C4lVJORK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 1D4F0802DAB4; Wed, 29 Nov 2023 13:26:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234440AbjK2V0Y (ORCPT + 99 others); Wed, 29 Nov 2023 16:26:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234361AbjK2V0V (ORCPT ); Wed, 29 Nov 2023 16:26:21 -0500 Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 902EC10D0 for ; Wed, 29 Nov 2023 13:26:26 -0800 (PST) Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3b844e3e817so150104b6e.0 for ; Wed, 29 Nov 2023 13:26:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1701293186; x=1701897986; 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=oMcpqMy/WvMvoKWfDIGBKOAFuUqj17oPCULwBqejJlE=; b=C4lVJORKiRKQoLOQRaMC0SKViy4tj5C4e1iiha9OLbp2gviPXgdHl7Xarh4ln2cEkD mS2A2YJWz12HOoP8DMLXJjMrGizPLGZm87yzy6xoItNNbf82ynA+kLSGoiu3ZcR56wux fK0Y6KaA80U64dwQzXNWcokDnh5vYwmj/VnBc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701293186; x=1701897986; 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=oMcpqMy/WvMvoKWfDIGBKOAFuUqj17oPCULwBqejJlE=; b=bn+5DuUc8fskVyHtFGi+wnqDpGtFnVm9XFV8gpkJzrVxQyOli1LVY5CJ3Y+kIx9sKf dE6fumlfVnPDKunZ6lKcPT6ashp2T240Z6zXFtfScyI00bNnP6/6aoLOOxuo6lv5GXX/ 20OyBV/DLIoToF5xk+LbwwGMGNmQ8MdCAMuVaUp6+GoNqUbsDlbRhJrVIIm3slSFZROX i+Qp7Hp9uZsMvvysUsy0ppX0ldMd13LmnBqG7OoWMH9FEbc6ArzuPKv4G0YIu8RTE1Df tr0S7AlGJkKbXifbLSq7auq/1z/R6IykT9pbKyqTmn56eoTQ/Ob2qHxdYdx+wNjy7mYF 98/A== X-Gm-Message-State: AOJu0YxkBF+E66sig1PUV4+l95BgH7U3rL+eK1F1j18biNkrI+ap5L3g X4ZfJ+dzGASlf6VE4iZ1lwf+mw== X-Received: by 2002:a54:4587:0:b0:3b8:37ba:7c73 with SMTP id z7-20020a544587000000b003b837ba7c73mr21628925oib.53.1701293185870; Wed, 29 Nov 2023 13:26:25 -0800 (PST) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:dcf:15e4:5f50:e692]) by smtp.gmail.com with ESMTPSA id t22-20020a634616000000b005c215baacc1sm11816336pga.70.2023.11.29.13.26.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 13:26:25 -0800 (PST) From: Douglas Anderson To: Jakub Kicinski , Hayes Wang , "David S . Miller" Cc: linux-usb@vger.kernel.org, Grant Grundler , Laura Nao , Edward Hill , Alan Stern , Simon Horman , Douglas Anderson , =?utf-8?q?Bj=C3=B8rn_Mork?= , Eric Dumazet , Paolo Abeni , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net v3 3/5] r8152: Add RTL8152_INACCESSIBLE to r8156b_wait_loading_flash() Date: Wed, 29 Nov 2023 13:25:22 -0800 Message-ID: <20231129132521.net.v3.3.Ib839d9adc704a04f99743f070d6c8e39dec6a1aa@changeid> X-Mailer: git-send-email 2.43.0.rc1.413.gea7ed67945-goog In-Reply-To: <20231129132521.net.v3.1.I77097aa9ec01aeca1b3c75fde4ba5007a17fdf76@changeid> References: <20231129132521.net.v3.1.I77097aa9ec01aeca1b3c75fde4ba5007a17fdf76@changeid> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 29 Nov 2023 13:26:40 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783935222782250220 X-GMAIL-MSGID: 1783935222782250220 Delay loops in r8152 should break out if RTL8152_INACCESSIBLE is set so that they don't delay too long if the device becomes inaccessible. Add the break to the loop in r8156b_wait_loading_flash(). Fixes: 195aae321c82 ("r8152: support new chips") Reviewed-by: Grant Grundler Signed-off-by: Douglas Anderson Acked-by: Hayes Wang --- Changes in v3: - Use `break` when we see RTL8152_INACCESSIBLE, not `return`. Changes in v2: - Added Fixes tag to RTL8152_INACCESSIBLE patches. - Split RTL8152_INACCESSIBLE patches by the commit the loop came from. drivers/net/usb/r8152.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index e9955701f455..c4dd81e2421f 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -5521,6 +5521,8 @@ static void r8156b_wait_loading_flash(struct r8152 *tp) int i; for (i = 0; i < 100; i++) { + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) + break; if (ocp_read_word(tp, MCU_TYPE_USB, USB_GPHY_CTRL) & GPHY_PATCH_DONE) break; usleep_range(1000, 2000);