From patchwork Fri Oct 21 07:41:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 6547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp547927wrr; Fri, 21 Oct 2022 00:44:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM421vgLhwdNUqQ02SbsHRewoy2ubE3qWpRKLcXT381U/NUdAop2twQbpGTpswe9l9AWYh6B X-Received: by 2002:a63:8141:0:b0:460:5be4:f6a9 with SMTP id t62-20020a638141000000b004605be4f6a9mr15050670pgd.368.1666338256851; Fri, 21 Oct 2022 00:44:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666338256; cv=none; d=google.com; s=arc-20160816; b=bzfYmlocwDT5StN8mMbg1+vbk25eG22+QdswijLeynAq+hP0xhOSOvqGjH3OTOENn+ BzCjX0HVSy48Qed7CoSP0Sk0AysqbiO9s7HTM8yrkK1eGN9EaOxaZNIQzYfui8Gr0KQ7 wPRB33HWxXVt424mf2UmwLuaWKuy8fRhAmTe8n7WOZzE6ZrIiBgkTEDCmeeU3YFSu/5U qxfuPXpR5wiiUwuRjqR6564wM10A+f0Cr/nkGNOO8P5JpBGmmYo4UTS23xhDfH+OIFO2 ssoxPdbys7z+v2BTMnWkPfT/8Wx+xhHKmZG//RpSDQsl9ecLXmFr2NhXVLwTPkVKRSsz cSyQ== 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 :message-id:date:subject:cc:to:from; bh=dsp8KTsdqDSVgm0qb1nkAcoMQC90fl0J6z+JoFKO6EQ=; b=amWa1wNyQWW8CGIJ7C3js+oy+YFpEXWMeLtpin7kDTBmMsq6PKtCeUsx2heciJLh7c 7q3YpmnYdvBdPob9ub/SMOJwCdsZ+1H0cLuAdwvEiqxxqayEkPVXr4mpILU9M1PBIIPq 1gObWem3sdadKNC9oDLwooOsp+V/2lLRpcBWnE/RlBqpoFwXHLRmIo5MuFz3RGXJ0NHk vBgik4/yfXY7ydWEic37N4Y9+bP0yjA9Su77yqtWVxqk5I/rp8TebbYCbcOp2oQScWOz cqIkffN8S859r82ro1QlbXi1xZroV83botTmtk/tF8f9RWL4oJZlzPRF+vq/eLhM2+bG +c2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i4-20020a63b304000000b00461ffae7b37si527654pgf.0.2022.10.21.00.44.03; Fri, 21 Oct 2022 00:44:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229835AbiJUHnL (ORCPT + 99 others); Fri, 21 Oct 2022 03:43:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbiJUHnI (ORCPT ); Fri, 21 Oct 2022 03:43:08 -0400 X-Greylist: delayed 63 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 21 Oct 2022 00:43:07 PDT Received: from mx.socionext.com (mx.socionext.com [202.248.49.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 32236247E0C; Fri, 21 Oct 2022 00:43:06 -0700 (PDT) Received: from unknown (HELO iyokan2-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 21 Oct 2022 16:42:03 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by iyokan2-ex.css.socionext.com (Postfix) with ESMTP id 1E0E520584CE; Fri, 21 Oct 2022 16:42:03 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Fri, 21 Oct 2022 16:42:03 +0900 Received: from plum.e01.socionext.com (unknown [10.212.243.119]) by kinkan2.css.socionext.com (Postfix) with ESMTP id 65360B62AE; Fri, 21 Oct 2022 16:42:02 +0900 (JST) From: Kunihiko Hayashi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kunihiko Hayashi Subject: [PATCH net] net: phy: Avoid WARN_ON for PHY_NOLINK during resuming Date: Fri, 21 Oct 2022 16:41:54 +0900 Message-Id: <20221021074154.25906-1-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747282303795436798?= X-GMAIL-MSGID: =?utf-8?q?1747282303795436798?= When resuming from sleep, if there is a time lag from link-down to link-up due to auto-negotiation, the phy status has been still PHY_NOLINK, so WARN_ON dump occurs in mdio_bus_phy_resume(). For example, UniPhier AVE ethernet takes about a few seconds to link up after resuming. To avoid this issue, should remove PHY_NOLINK the WARN_ON conditions. Signed-off-by: Kunihiko Hayashi --- drivers/net/phy/phy_device.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 57849ac0384e..c647d027bb5d 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -318,12 +318,12 @@ static __maybe_unused int mdio_bus_phy_resume(struct device *dev) phydev->suspended_by_mdio_bus = 0; /* If we managed to get here with the PHY state machine in a state - * neither PHY_HALTED, PHY_READY nor PHY_UP, this is an indication - * that something went wrong and we should most likely be using - * MAC managed PM, but we are not. + * neither PHY_HALTED, PHY_READY, PHY_UP nor PHY_NOLINK, this is an + * indication that something went wrong and we should most likely + * be using MAC managed PM, but we are not. */ WARN_ON(phydev->state != PHY_HALTED && phydev->state != PHY_READY && - phydev->state != PHY_UP); + phydev->state != PHY_UP && phydev->state != PHY_NOLINK); ret = phy_init_hw(phydev); if (ret < 0)