From patchwork Wed Nov 29 21:25:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 171572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp628823vqn; Wed, 29 Nov 2023 13:26:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4ziTdFFSfdIYxjfQei/rVjmNjlDRGaDu1obUQsR9EA3BQoZbQysq0XaWo9dq0BrNrW2OB X-Received: by 2002:a17:90a:1a03:b0:280:2652:d4e with SMTP id 3-20020a17090a1a0300b0028026520d4emr19827577pjk.29.1701293215226; Wed, 29 Nov 2023 13:26:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701293215; cv=none; d=google.com; s=arc-20160816; b=F9i51+yeLECRk+FqKh43kyuN7gxGxH840If6ndlRoZ3Dht5xDsRCPNREmsdSykXXAR bsdnLznBIsMhzSzeLFfd0lJkF/3HMQoj66cU853zlzTMWjWQ4ooEgq3RiKYuv8rXoTt9 oY2z0wVpW3Opr2E11uv4OfZRKxWVzStd8DZ25EtRtttMj0gtoVYlKhPHiTyFIDOjXkLM w1oGVg2vxX4fGl0Irt+Y5v8/m1H6GW+2nq3TqXNISv7TRSbUu2Ng7eLO+ITupF/0N7cB mvUUOa9fpEEMToS3jdwQkIxPtieuD/fwXAlvpq8syCsGSAZfqT5tB0VFYwHIQQih/E/Z QEjw== 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=YbdqD7No7SCueAxJzZPzHLsBDwHJFNtjAFZMErwtoME=; fh=VdJ77sXi4YbaXhBycfIaOIRg0WShF8sXRrTaiSi1nOI=; b=uqsl2d8THVMh8hamSqUE6ZkDpQL+Vrrb6sPXHWFp4BFF6GRQtmIsUjIpH3Tx1DrJJw n6541M1JfNnt/F17sJYltEsbkMqHMIxm94IxAHgF4jGCTBc2O5TLtKc1hUpuv6TOT8rk lEnwt8sQEUJKsCK05EtLL/0DQW5xqesytKpxQKf/8zC4wOKMnj2TkYU/tGUwxl06EFQN 90pa9t+3W0EW7Jo4kssdUoZvWxG0CcKGcHGmMDQpE/eF/LyawiDGzIRTllt27Ip5aDTi MkI35kPwpTz0QCW/TBQpkvXZ9XkFzmfFTmbBnGzo7J9JamFeGfLDxWboKiL7KWOV3wvU T+7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LKw4kFTK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id q15-20020a17090a68cf00b0028571ddddfasi1980201pjj.146.2023.11.29.13.26.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 13:26:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LKw4kFTK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 072B38032A21; Wed, 29 Nov 2023 13:26:48 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234491AbjK2V01 (ORCPT + 99 others); Wed, 29 Nov 2023 16:26:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234427AbjK2V0W (ORCPT ); Wed, 29 Nov 2023 16:26:22 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CD8C10DB for ; Wed, 29 Nov 2023 13:26:28 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6cde104293fso261549b3a.0 for ; Wed, 29 Nov 2023 13:26:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1701293188; x=1701897988; 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=YbdqD7No7SCueAxJzZPzHLsBDwHJFNtjAFZMErwtoME=; b=LKw4kFTKjkUYR/kWCjARKDyu5veQQCEcUP2K1je3QBwvmlW6e6ceZ67Rf0IGyDpAly ByojlZg1en/fr8ZOPzWdq7gyZeS3/iHEW54WLHwxVcE41eTkpRYGlcrkoqYbfkZLVVx4 IHfOJsXjCA74y9yYlzAJ8KoHaGlVN7fflVfgg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701293188; x=1701897988; 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=YbdqD7No7SCueAxJzZPzHLsBDwHJFNtjAFZMErwtoME=; b=PCdIekZ8JRJz77J6gR2RHwkweSlKve2Zn3c7jV5+zn4Jl+D0H4YTm60j2lURhddG/3 U9ZWkajxDy9RPyth4x6QmgmNcNELt3g8BVcW8VF5TnFzJYiNMNNDf3q1KNXvzukXBTf6 DHPEKAn2i06oM+Ife7kfgJaB6M5DNKAbaYBFbBMXKCowr/cC33FOXJSi3EbxUmFXKG52 rwhiBs3N/h2AQhjYHzm2jZzLP5zpgfEFs6JjGjbcX7lE2fb5jIjZ0uVcZRBxe+az+zHf /rNrITEQNJtPImZory7eVBUn47L1VTK4+0NwGAIi1fQAMRnsnGdyoXIb4zpEmzh6E2VK X8uQ== X-Gm-Message-State: AOJu0YwRza+fVSY71AqJQyEvVb8GRFGSDYNRUu6eU84KqR9/WPEJ1ujf WB5/l3RLGuDsp3K4ptyeM7EekA== X-Received: by 2002:a05:6a20:1581:b0:18c:c37:35fb with SMTP id h1-20020a056a20158100b0018c0c3735fbmr19950181pzj.40.1701293187747; Wed, 29 Nov 2023 13:26:27 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 13:26:27 -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 , Prashant Malani , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net v3 4/5] r8152: Add RTL8152_INACCESSIBLE to r8153_pre_firmware_1() Date: Wed, 29 Nov 2023 13:25:23 -0800 Message-ID: <20231129132521.net.v3.4.I9c7bfe6fb76850f0323b3996e25a10ef0281fb7a@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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 29 Nov 2023 13:26:48 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783935234018948739 X-GMAIL-MSGID: 1783935234018948739 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_pre_firmware_1(). Fixes: 9370f2d05a2a ("r8152: support request_firmware for RTL8153") 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 c4dd81e2421f..3958eb622d47 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -5645,6 +5645,8 @@ static int r8153_pre_firmware_1(struct r8152 *tp) for (i = 0; i < 104; i++) { u32 ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_WDT1_CTRL); + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags)) + return -ENODEV; if (!(ocp_data & WTD1_EN)) break; usleep_range(1000, 2000);