From patchwork Tue Nov 28 21:38:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 171004 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp4244746vqx; Tue, 28 Nov 2023 13:41:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGEjQ0BJTjeCyWXCtslTTOakJ7Um1eLZ9gG6RgPzpIkMvUxt4qHpnUIZ7gbrHDq85+L/Vgs X-Received: by 2002:a05:6a20:4423:b0:187:a6ee:9d6f with SMTP id ce35-20020a056a20442300b00187a6ee9d6fmr29335343pzb.0.1701207707596; Tue, 28 Nov 2023 13:41:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701207707; cv=none; d=google.com; s=arc-20160816; b=lY8DTX4VaT7Urnt4Or9YMxjel/wMUyctXm6wab19IfM8VTxfyL7FxP/09DZ5rEDzKG Ie5zHcFLMPuaWfQHI6ZCeNmxvUL4LCEjwlVTqxc+mo8WgQRvy9npDyRW98VT0RPP+Vu8 ggMekAkF1HnUviUVz5sj5Ur5UCQ2fStsxW9ibiU4jKa8wuE0D4FnlvvuJHcpptqk03Is Dt6S8Agv34jzzxVWceZUBwzMmFcbyV0bozdwqv8e7OsfNXXSAspP003PUAnIQd3rl97C q2X49sota+13SxILa3/iotRhQCWlaXBJUVAJYX+E5Y0X7SzJOsog6q+D4DjORuPSQb1u PMlA== 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=fdYFcaVqzynOfnyusz8jDR2UhNqPzUcp03x21uK643I=; fh=22hb6jpa3U0O3+lqzBmww6ef3+b+RiaWxLVxVjCvsvk=; b=o2dn4ygTpejZY+iu3t3JKZIA4Nj5mZrCZSp3lM5rsdWLtMKMqJ6oSI4kE4cRUvnWZ1 JyMQnGG3+TlJTB8mVXj4feUYO5r77ETUvkxDOK5t5Y6K5cf1L/refplwbbDxzbfKSqsA ayNeihk5+bjjL3xV/nFpSWLSTknvlqnZ8s8LXPSIylXqYKkIrd30lJFqqcV3M3hWhAt7 0wmMp8brVMgQDAfa6kNlbxyX7RhEGIQ4KpGDdRdOeJZ6j0hftt51mpmKSE+8kis4A72v ZXdwwI5dCmZQbTjEAfwRDUWTsmPTSxfc1VVsYAJ7+Rcih/u2rtGs0SRap5BYBHSmTB6Y O3cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KwXj6vzw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id g23-20020a63f417000000b005b106cd44d1si12890166pgi.486.2023.11.28.13.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 13:41:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KwXj6vzw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 3642C8090054; Tue, 28 Nov 2023 13:40:55 -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 S1346561AbjK1Vkh (ORCPT + 99 others); Tue, 28 Nov 2023 16:40:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346227AbjK1Vka (ORCPT ); Tue, 28 Nov 2023 16:40:30 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F988AF for ; Tue, 28 Nov 2023 13:40:37 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-285699ebabcso194519a91.0 for ; Tue, 28 Nov 2023 13:40:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1701207637; x=1701812437; 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=fdYFcaVqzynOfnyusz8jDR2UhNqPzUcp03x21uK643I=; b=KwXj6vzwnAzCxZVnBkxy9sUifv4hVmU8/mAmFjpVsWTM2piSNBFene7KvluylT9APd EmtauclLAcFPAbqT53jQakuUt0y1jMNFS2P12ktGFM35hqutbY9oIGAGQdPO9c+YPFQM Fkd398kFP06nTYMPl47Y1cQNG4yt/aPLfVUeM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701207637; x=1701812437; 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=fdYFcaVqzynOfnyusz8jDR2UhNqPzUcp03x21uK643I=; b=t8u+ACvtZglO5NPVUj1W4CzZWjUAvNA74x16L5fHSNoI7kZyDrsXhNF8s0abZ8uVYN lRRv1JycAtx/vunBeOnvzX/QM+CayyZUh7Gk5m/4RY46GrqJiz27Pvu8ntW0+7c+/SrW OtJCtfd0eTZ6h+jT3RW3Xmks6U9ZkixrFZ8n3mDUxCsXXStswmEmv9NQTU4ne9Sg/kdC D4C6IfSXYYD7Co/LX1OOr9wol87D0H6+7iwNy0e8keZ9iODPcF9MAVpxFzpy6IkdfhaV NZaxg/tu4XxtjvQxUYvUZOU8zvPK/vrh0x5v7Gpz75cNmeQIOEGqjjb0I1G1BN+GdXz7 BS/w== X-Gm-Message-State: AOJu0YzCa4dm7kbo3WKbnCPfLqEZZtSe/21PYBaDl8oK0givOEmNxj3v /kXxF6q6BDC3U88Z35xOxMk/Mg== X-Received: by 2002:a17:90a:ce81:b0:281:3a5:d2ec with SMTP id g1-20020a17090ace8100b0028103a5d2ecmr27744675pju.8.1701207636843; Tue, 28 Nov 2023 13:40:36 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 13:40:36 -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 , Prashant Malani , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net v2 4/5] r8152: Add RTL8152_INACCESSIBLE to r8153_pre_firmware_1() Date: Tue, 28 Nov 2023 13:38:13 -0800 Message-ID: <20231128133811.net.v2.4.I9c7bfe6fb76850f0323b3996e25a10ef0281fb7a@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=-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=unavailable 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]); Tue, 28 Nov 2023 13:40:55 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783845573221545934 X-GMAIL-MSGID: 1783845573221545934 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 --- 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 b7bbebf09d85..26db3f6b3aa1 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);