From patchwork Tue Nov 28 21:38:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 171001 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp4244524vqx; Tue, 28 Nov 2023 13:41:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IHK2latvLq/2TlctUXaiQzDkY7+rTKIv+eY6SqsnVrcfGPr3LwfIFjMMpej/4MDIlro5ghW X-Received: by 2002:a17:902:c405:b0:1cf:a70f:3a2d with SMTP id k5-20020a170902c40500b001cfa70f3a2dmr20379796plk.63.1701207675360; Tue, 28 Nov 2023 13:41:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701207675; cv=none; d=google.com; s=arc-20160816; b=z8Kgi5KRM00nsm6c+4EwC4jY3i2ax2vV2iYlANZthzYAamHdBLqwcu9W75KcLrqsh8 54fdbUW2lRYAjSlc8LP6bz+oJ2uDFwNnDk4BZbZw5UMaPjvGcd9pIAS4m1LLvXatyka6 QDep8SltBVd1mozn1ZFf2eEhXkJEAkIoRMFOCi933WlruLSe5jpN0okYMTV+s0178uyE EJegJSVZRveuGzucNLnHCRvfWRJlHhPWyYY95AXpG34nXVPWB66mmHKOFjYwXhSbFmOu XaFs6MmceEzCgdArigvwuxdYtbAFfP1AHY6YnQHfwIsdwFYeOaOy+BiV6CPuYSkGB9yU GYMA== 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=NQpgB0hpYD1c6hlujz/aWaKFzOCbCq1mG9ijFrvdnyY=; fh=D9dulkN/zvJqgx62bWffkTYlpM2spfXLLqBXpsKZOmw=; b=F4brsL33NGae33HQ3mQYmrsiEUimolglOlhFQU6Z0cNN9TLSLRn+PF1M4T/KPRknsa sIbJbnJN4PpVWlm4gm8692rTpwPi/fCd2CPSh8YxgLbJhHnm4SsOXWbFKsy8Q7ElmVrU S4La9KkaEqVoo4UKRnkQZrQZ+uzSiuvYrZAoVtYqC4oH2QL1J3LssV/IWzftabNf+rDN 7vj+iexVDMwCmof8h49EF59lAJ9zFLNuHo5nqyE38jZBJVMTU7yZcgeaXA0ZNuelNi53 WDlXiwcQ9QcpbcahscfscBnKPVHrVzjoje/FwnUTvn2tPudxD83MMpK7/Yg+a2UQ4UJw MErQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QKBAge7S; 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 u13-20020a170903124d00b001b045d65aedsi13086234plh.228.2023.11.28.13.41.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 13:41:15 -0800 (PST) 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=QKBAge7S; 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 076D9807F48A; Tue, 28 Nov 2023 13:40:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234935AbjK1Vkp (ORCPT + 99 others); Tue, 28 Nov 2023 16:40:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346486AbjK1Vkf (ORCPT ); Tue, 28 Nov 2023 16:40:35 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4235D100 for ; Tue, 28 Nov 2023 13:40:39 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-285b926e5deso3019388a91.0 for ; Tue, 28 Nov 2023 13:40:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1701207639; x=1701812439; 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=NQpgB0hpYD1c6hlujz/aWaKFzOCbCq1mG9ijFrvdnyY=; b=QKBAge7SioihvVYTJUi05Yn5Bn9zeEOnfUYcXt3FvjWfrjySzZRNsKb9E3gQUikNpE 0VWMg4qMHdBvsMqsZEtXSNGLUByzNdV/d+Q0YxbyXZTChLYxKjE8+H13qpuZjm5hCB5v 1RH/TcQydFs38goys7py72n3XAbLte1AHFJcw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701207639; x=1701812439; 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=NQpgB0hpYD1c6hlujz/aWaKFzOCbCq1mG9ijFrvdnyY=; b=G5rhau3WcMLWQOst1mw3XFkMLAn7rpzz+cXvrIjYsYD7oR+asLlFH5B8GzgPLAFCyh X8Mq5dLhDFFnXjG/z1mD2apOgPswzvnH+DF3uFcr6JqWMCatAQql/UFq/z2EgcZOJHGH gYp7ICujYe6ew6h51LG+p84fjiyNkCcc0gwucMlkWKTIVSmbh4kRpjN0//07H0afZ9r9 O3SST2h20rBp+ZucQzh4YqwGsU/KgNGT0jJR0f3Ig4WankQOsVDnv2HBlffGW3q67J9s zNQ7B95vyhA6H7mG6DnuNZWYX+efxKCLLdpJB7yPLxI3oBX3fVAdc72GLDeH/JHGyGIK buQQ== X-Gm-Message-State: AOJu0YwLG826pr9IEBwKBNMTe9JdExf6FxiA3UvCSVb5HRCgy3/eit3I I18/xb7g6c6FUyRCA2yXeYTI5A== X-Received: by 2002:a17:90b:4c50:b0:285:8407:6152 with SMTP id np16-20020a17090b4c5000b0028584076152mr17639969pjb.8.1701207638788; Tue, 28 Nov 2023 13:40:38 -0800 (PST) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:fc3a:13ce:3ee3:339f]) by smtp.gmail.com with ESMTPSA id ie24-20020a17090b401800b002609cadc56esm9634285pjb.11.2023.11.28.13.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 13:40:38 -0800 (PST) From: Douglas Anderson To: Jakub Kicinski , Hayes Wang , "David S . Miller" Cc: Laura Nao , Edward Hill , Alan Stern , Grant Grundler , linux-usb@vger.kernel.org, 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 v2 5/5] r8152: Add RTL8152_INACCESSIBLE to r8153_aldps_en() Date: Tue, 28 Nov 2023 13:38:14 -0800 Message-ID: <20231128133811.net.v2.5.I1306b6432228404d6e61b2d43c2f71885292e972@changeid> X-Mailer: git-send-email 2.43.0.rc1.413.gea7ed67945-goog In-Reply-To: <20231128133811.net.v2.1.I77097aa9ec01aeca1b3c75fde4ba5007a17fdf76@changeid> References: <20231128133811.net.v2.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 howler.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 (howler.vger.email [0.0.0.0]); Tue, 28 Nov 2023 13:40:55 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783845539191291999 X-GMAIL-MSGID: 1783845539191291999 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 --- 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 26db3f6b3aa1..aca7dd7b4090 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;