From patchwork Wed Nov 29 21:25:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 171573 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp628862vqn; Wed, 29 Nov 2023 13:27:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IH3vNUT68es4/0fUFDgEQ+igRRfny7FlngTz0nYuBq9Y0pmid8iVM24rrpVDirPKlJ9Sn8R X-Received: by 2002:a05:6a00:35c7:b0:6cb:4c60:7398 with SMTP id dc7-20020a056a0035c700b006cb4c607398mr18512177pfb.13.1701293220028; Wed, 29 Nov 2023 13:27:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701293220; cv=none; d=google.com; s=arc-20160816; b=KnHggiTlapZo32xDW2iN7Pw1nI53/KMEp4cgD/zGwN0TsP39MHR2ftJMdPsjlD1o+w KeUFVA2v/qhunHTZGAInWV60Fk0TApkXWgb8mIuYIN33upCfsP80+2L5y5mM57D2YUuv kDCkPt7fXEqnEUVfQlXE6gdtSY5Yl4Ei/qvLM0InSpuhv7SntKyHP1wJnGko4eimijQR FMM8ZtrHo2fwCCkOZVOW+SJZc6pEAc06DkwYV1GYOhKLM1l7RSGYyGWJpoGDWM7+JQ74 bMFf9AZJ+T84G16CyKFpmVPeA7dJY9dsJMubrn1UThlEnWcAQZQbKJnRQ6BN9CwZ9Xic n8wA== 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=MOZ1iLO8KtuEsZF7yZy5/8QOIlpTKo1m7A68f7ka2pI=; fh=mRHaPBoaK/yKIiTe7zbQTMuaXdIOIrIp8KgHhHuSvhs=; b=BrULrCmUBlvGmnGdhnO2t7F4pYe5OPR41wqO7f3eBB2doWw/CBnhqbm7OPLgVZPaoj bxNdLhlr1AdXRvv5PHeC4QAsMYN9zBp00SZLBpDfW/I/sLSDf67z1aomaQ5Cl8TDOj8v O8TuHg1PnppJc8A/GVZLuXeTLEI6ke6ISfyiB++aH7j6zWOfGV7kOsyOiWTbjs3ozMwP 1QFAQV3C3QsIivZIQio8CPR+vJWqihuCDQhBA+LcqvIQf498yIP7qZA9Gdu48wOD7ypp GL4F7mw++YcWAz9UnMsBkKQx6dH1c66TmdNVG8nVEQ5zAjo0bNz4qO/Jqt5rSzc8yzXW 7VjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=MJHG3FeN; 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 f27-20020a63101b000000b005b95f5f8976si15096154pgl.634.2023.11.29.13.26.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 13:27:00 -0800 (PST) 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=MJHG3FeN; 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 2854781C394B; Wed, 29 Nov 2023 13:26:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234540AbjK2V03 (ORCPT + 99 others); Wed, 29 Nov 2023 16:26:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234456AbjK2V0Y (ORCPT ); Wed, 29 Nov 2023 16:26:24 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1136510C0 for ; Wed, 29 Nov 2023 13:26:30 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-5c18a3387f5so199689a12.1 for ; Wed, 29 Nov 2023 13:26:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1701293189; x=1701897989; 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=MOZ1iLO8KtuEsZF7yZy5/8QOIlpTKo1m7A68f7ka2pI=; b=MJHG3FeNRJCV08bAES4RXwkf/jmlD7P+a2DJaKxg4x3vMs+05LcH+QtFy6akdFQxNB GAiYp/SgiSOcPphniGk4d5fikI0D3hXbOwqQqZ6fEN+PsdOdJ9QFKYkGgjSE5/FljEDN 5YZqk667LykslGSxFsmP6n2C6HeqJDnuk3XsQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701293189; x=1701897989; 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=MOZ1iLO8KtuEsZF7yZy5/8QOIlpTKo1m7A68f7ka2pI=; b=VrrWqGyWAK76LYkUKgqnT7ybSoPCduPaPA8NsZBz/K6Y/7AGf2n99x/FUzfbWDdcCI rre5p42Q++Mm2jUXtGE31H/0jaCuzl+geT5Ls46DC8IA3WLOS1wmwo2nfZ1FZaEfQpAF nteETSVVcDT1boglVvHBbVMKa37KeivbpzztEHveG6PNiE8UPvdLtHHO2zg0IS16yYdZ mV2TlL6L6ghyzyoU1pJmBHEYi3Ez0UpTrnNcWNv8yeYS89e0Y0xKkMwi/21JYITZBEDG cMgmnjdYdB8RzZGALpZ72iAl152NnSQzEFB1/i1hdRT+dU/egT+q0IvPm/NtxZk3acK1 6EJg== X-Gm-Message-State: AOJu0YwmPts4070BqyXJpclz0BVFW0Uq42wuXDtz2OalrRxIrxIiHMXL z99afX5Rr4fdXaMOvJUokUZnjw== X-Received: by 2002:a05:6a20:9698:b0:18b:4dc2:a4e1 with SMTP id hp24-20020a056a20969800b0018b4dc2a4e1mr18432953pzc.55.1701293189548; Wed, 29 Nov 2023 13:26:29 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 13:26:29 -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 5/5] r8152: Add RTL8152_INACCESSIBLE to r8153_aldps_en() Date: Wed, 29 Nov 2023 13:25:24 -0800 Message-ID: <20231129132521.net.v3.5.I1306b6432228404d6e61b2d43c2f71885292e972@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=-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,T_SCC_BODY_TEXT_LINE 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: 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]); Wed, 29 Nov 2023 13:26:52 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783935239687019916 X-GMAIL-MSGID: 1783935239687019916 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 r8153_aldps_en(). Fixes: 4214cc550bf9 ("r8152: check if disabling ALDPS is finished") Reviewed-by: Grant Grundler Signed-off-by: Douglas Anderson Acked-by: Hayes Wang --- (no changes since v2) 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 3958eb622d47..fcdc9ba0f826 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -5803,6 +5803,8 @@ static void r8153_aldps_en(struct r8152 *tp, bool enable) data &= ~EN_ALDPS; ocp_reg_write(tp, OCP_POWER_CFG, data); for (i = 0; i < 20; i++) { + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) + return; usleep_range(1000, 2000); if (ocp_read_word(tp, MCU_TYPE_PLA, 0xe000) & 0x0100) break;