Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3534449imu; Mon, 7 Jan 2019 05:14:02 -0800 (PST) X-Google-Smtp-Source: ALg8bN7WfIqeHGSHWAaAHNlSorlIy6gS2IQxE3ZAIL5FDlzZQUl70R5jEO+R60CU47RsNygW1p7G X-Received: by 2002:a63:a401:: with SMTP id c1mr10941367pgf.403.1546866842368; Mon, 07 Jan 2019 05:14:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546866842; cv=none; d=google.com; s=arc-20160816; b=o5oXk5E51Ni78gM6FugtbNWETSd/dfOXqD/b3Qsuj/wmsajBHfK2tGmLmU7uKXGXeM 2TiE+iaxbtXyj1afNIUGNYhJM2rujjW67heOQ2wKbKrLR7L1F3iuz9mNX9v1fYV4Dpul AMZs2h7DgXJc80vFL8BUxv4BKC+NBx5lPlpKB24EJttq7I3t6SuAGzVVGbuqEstWeYZA kI+r+CpDBdEbMgz4ODJOgrq4WUiA9ksPmmPM2ivk6iKuknIgPoxWXlWPtHZN8j29zwPv UaeqaLKiEqi/PT3YKX6m3E2ReXTXUFPOj4BPNt7oWG7HRSH0xD3zmzoJy80BBwsbzrO3 XlMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dA6UNLD3kFEJ4gspN5+aMj18Au7iogfNo+0d+8EuHU4=; b=ODxG7RzmUHrb/Gf6gfSLdyTxt/VDPN0Vb2isV9ULnbbAPW+ShXKsyxEX4DY0USci65 O5qHUO5KlCcp+QOcj2P2JXs5s9TsRAtUrEeb/1AD4mE1dZmzVWz9+nuj//nlZW0vMEZ4 Bby+0NsGzeFmfSoFBucmhvMWLpnTrSs7AtNx0EU9MFrm6TIB6nOdXnDUe0eFx94MWlUc WmM0mEemM7Imu2IAI1/XxndAsc4cmAwOf6z80ylpyIGunvdEkEMkdwEI7ae5A+0QXHYD ivMRjNqfJya1Dh7W0TqcSPbP2q/AVUQrNJ6McM0A5LoskMUxmSM/XiQ2O+ZZBq7A/EvK nnBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cIhUP8dK; 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 c31si62478509pgc.465.2019.01.07.05.13.47; Mon, 07 Jan 2019 05:14:02 -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; dkim=pass header.i=@kernel.org header.s=default header.b=cIhUP8dK; 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 S1730903AbfAGNGU (ORCPT + 99 others); Mon, 7 Jan 2019 08:06:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:52816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731416AbfAGNFE (ORCPT ); Mon, 7 Jan 2019 08:05:04 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AC1402089F; Mon, 7 Jan 2019 13:05:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546866304; bh=2FWS+KwRw94y9YO7I67VbogiNiu6vCNfuy4q9exOuTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cIhUP8dKXi3u20eGkMKh0qrUX1JR3Cv0cL+788rtnsUxBo2Q7I0qIFn0+tfjD/LBa QLby64I4xwbYlTUxJUV5MhMjkn1uZAPJ9XfrSgl7QMCqF/1SUmiKUyYg85iy5hik0g mSsZT3Yl8kJVaEOHQo4njsgPzuQivRIWt2P7T11o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiner Kallweit , Kunihiko Hayashi , "David S. Miller" Subject: [PATCH 4.9 13/71] net: phy: Fix the issue that netif always links up after resuming Date: Mon, 7 Jan 2019 13:32:42 +0100 Message-Id: <20190107105331.551409966@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107105330.280153213@linuxfoundation.org> References: <20190107105330.280153213@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kunihiko Hayashi [ Upstream commit 8742beb50f2db903d3b6d69ddd81d67ce9914453 ] Even though the link is down before entering hibernation, there is an issue that the network interface always links up after resuming from hibernation. If the link is still down before enabling the network interface, and after resuming from hibernation, the phydev->state is forcibly set to PHY_UP in mdio_bus_phy_restore(), and the link becomes up. In suspend sequence, only if the PHY is attached, mdio_bus_phy_suspend() calls phy_stop_machine(), and mdio_bus_phy_resume() calls phy_start_machine(). In resume sequence, it's enough to do the same as mdio_bus_phy_resume() because the state has been preserved. This patch fixes the issue by calling phy_start_machine() in mdio_bus_phy_restore() in the same way as mdio_bus_phy_resume(). Fixes: bc87922ff59d ("phy: Move PHY PM operations into phy_device") Suggested-by: Heiner Kallweit Signed-off-by: Kunihiko Hayashi Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/phy/phy_device.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -163,11 +163,8 @@ static int mdio_bus_phy_restore(struct d if (ret < 0) return ret; - /* The PHY needs to renegotiate. */ - phydev->link = 0; - phydev->state = PHY_UP; - - phy_start_machine(phydev); + if (phydev->attached_dev && phydev->adjust_link) + phy_start_machine(phydev); return 0; }