Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3509059imu; Mon, 7 Jan 2019 04:48:56 -0800 (PST) X-Google-Smtp-Source: ALg8bN4bBQKVuGLzUNcH8rYxqziJrGOLB0pz4ZW3eaJSU1Mi8OfvKGvyMS22bLwGz1UE1WlzuTUg X-Received: by 2002:a17:902:583:: with SMTP id f3mr62755619plf.202.1546865336851; Mon, 07 Jan 2019 04:48:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546865336; cv=none; d=google.com; s=arc-20160816; b=TYUuEw0yle0wJQgfTLl9NsInzTJ+m6wdQZOvY45Hu64guL8xYRBUTbEEd3h/KbRzXM 55DUIOXE2q2+1mjRtSFd1xxvXholGjeVsQAx8vFWmOzBBlAkzCzplqEcjQtQQXiKwggj gRuIBjRVGe+P1tccwZo8sgC+q0JVz1COB3qVc+tS4pwSFCHePg+kKbgr63z+Dw5HxrTG 05Jb9TwCrE3Aqkx4VHP4nXwmrAhnbVZkp1Yhd+ksHqfEwN4KTkzJHC+6ZTtbPeRzIfJa HKXbaPQU08oN1nwFwx9ykA3f4GK41/xY6J51ryQev2a9y3EKdMU7MAtQxHeDdLMOhRFR aTtQ== 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=u6SoK4w69lm8tPgp0Hxbt56DmvkpBKYQaT4593Jxc0A=; b=ZUOqdbZGS6AcIcQKvku2EpHAaJsVTurHliM8LQIHb3BJBRyAkDtGl8cHGgqf2IZxZK R3vSP6lht5562JTA3hBgzAppMq7g1jRc56zz2B7YA3HqwpHvyykinHSDkOLAJnmKEdPb eOCS4icPwrZKe82QTS6iELNrcD8tDpA2OMZ7pXCLYRe57SCsXd98OmOzZk+eujqihwja HB0X9xfuG8JEtCx4r8nB9iyFvdF/kBQSpHCbVwTpLaym+o2vbDSBg3GLH/jCSgTkkmeS j4zEJPE/k2q7KT4JfQgIvYS/KUv5ZJr7HwABAmZZxytXkhlcjP7DNxMXsAGicWlvoiqU ekWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yHCM1Wz6; 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 f189si6846974pfg.123.2019.01.07.04.48.41; Mon, 07 Jan 2019 04:48:56 -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=yHCM1Wz6; 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 S1728929AbfAGMpq (ORCPT + 99 others); Mon, 7 Jan 2019 07:45:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:35214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728914AbfAGMpm (ORCPT ); Mon, 7 Jan 2019 07:45:42 -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 2A78C2183E; Mon, 7 Jan 2019 12:45:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546865141; bh=XQ4bDL8QOtY3q/l8Svb57V2H7TDJ4zk2e9klQAPRtr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yHCM1Wz6xS9TUSTRVqIZKFWfhcJ9qmbzg0HR6ssms1ez7kSnhU9I7372hfvuSVnjx SCuFRUtvGDBvr46yplfAGlpa40pdP9bx+5sj0oIF9bsGllIr00WmDVt8BN2lAwZVqG EFzzafza1R3ulloEEjv0/WDYOZK4dSlknQevKlmE= 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.19 017/170] net: phy: Fix the issue that netif always links up after resuming Date: Mon, 7 Jan 2019 13:30:44 +0100 Message-Id: <20190107104455.068553047@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107104452.953560660@linuxfoundation.org> References: <20190107104452.953560660@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.19-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 @@ -164,11 +164,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; }