From patchwork Thu Nov 29 08:12:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 152375 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2091755ljp; Thu, 29 Nov 2018 00:12:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/U/0TrTtwNU62FKtiBwY+J9x8ofWnFPcU/jgdK9w2zWEKhn3QOwk92wAGeuz2gZ9gsKDqj+ X-Received: by 2002:aa7:8758:: with SMTP id g24mr467688pfo.250.1543479155392; Thu, 29 Nov 2018 00:12:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543479155; cv=none; d=google.com; s=arc-20160816; b=u1/cjOKpcbGuKrbw/EoSHKOHVjUDqfbBL/angfg17+kMZevpDi81IXpPYET4MmVyD+ Z4gw7sSfpSaxDWTkMuXhCK/jXHZomdlOhpgNM9W8mZ4fCsV0xsOdSuSigUNjMCSj6W2j b2hQVL1hYcjZV+c2vYiPzlrjJmtiBgFHyjJ3hqcLiy3yXMoDObWBJg6ZsbGeEcvy3c4G /fyPPowDF4owUbqNgqBO1E3B7xIoiQ5VHpC1wxYuKVaJR3EkX7cX+h6MVfqqrVeBXNPe QWU5Bva9S6hUJtqi7i+qxKufFCD8lq+IY549PPlxGTbLpL17/yzv6d9lnclfuv+xTP6b J+jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=t4ixZwVGx8bqYkcK3W+Z7T1GoVrX2/el1NTlKR6P+0o=; b=vlUswtoxBcM/0zQ90ZhbchuK/WHezdsv613Lru8xZph/094xdA0CLIQ075ddcUjGJf siOmP0wMekKeaqUrXyWWZLalRBdRwy237zfW5x49IvctGy2jlAn9lnvrJhUoM0y4e3D4 oJ0stLnpkfs8O9sdqNVyPmKocXuBhwllUinvVUrOpd62I2pIeRv/skkh07RWijMDwltt ttFJG7YofuuHSc2flduQEcMosj9suH1ap2TDPwufmMsvsw8II8fD08xKdbGu28/ln0Vg esNKYt4avCGp20V4AWeEU5HRlKy+cJN7N0a5IYCx8i3vp+aHdKJtExgBKCIHx5Xij4tk ovbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x5si1092445pga.440.2018.11.29.00.12.35; Thu, 29 Nov 2018 00:12:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727946AbeK2TRF (ORCPT + 32 others); Thu, 29 Nov 2018 14:17:05 -0500 Received: from mx.socionext.com ([202.248.49.38]:4225 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726651AbeK2TRF (ORCPT ); Thu, 29 Nov 2018 14:17:05 -0500 Received: from unknown (HELO kinkan-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 29 Nov 2018 17:12:32 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by kinkan-ex.css.socionext.com (Postfix) with ESMTP id 8C6CE180BCB; Thu, 29 Nov 2018 17:12:32 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Thu, 29 Nov 2018 17:12:32 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id 3D8BB1A1236; Thu, 29 Nov 2018 17:12:32 +0900 (JST) From: Kunihiko Hayashi To: Andrew Lunn , Florian Fainelli , Heiner Kallweit , "David S. Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kunihiko Hayashi Subject: [RFC PATCH net] net: phy: fix the issue that netif always links up after resuming Date: Thu, 29 Nov 2018 17:12:11 +0900 Message-Id: <1543479131-14097-1-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Even though the link is down before entering hibernation, there is an issue that the network interface always links up after resuming from hibernation. The phydev->state is PHY_READY before enabling the network interface, so the link is down. After resuming from hibernation, the phydev->state is forcibly set to PHY_UP in mdio_bus_phy_restore(), and the link becomes up. This patch expects to solve the issue by changing phydev->state to PHY_UP only when the link is up. Signed-off-by: Kunihiko Hayashi --- drivers/net/phy/phy_device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index ab33d17..d5bba0f 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -309,8 +309,10 @@ static int mdio_bus_phy_restore(struct device *dev) return ret; /* The PHY needs to renegotiate. */ - phydev->link = 0; - phydev->state = PHY_UP; + if (phydev->link) { + phydev->link = 0; + phydev->state = PHY_UP; + } phy_start_machine(phydev);