Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp659314ybg; Thu, 19 Mar 2020 06:33:24 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt3oZoCLwUA9plIuTfMMrd01hyiKFFit2zEw5CuFtlPCjuyjWPhDcggCaTXTKSfqXWAJvAV X-Received: by 2002:aca:4fc7:: with SMTP id d190mr2383027oib.100.1584624804409; Thu, 19 Mar 2020 06:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584624804; cv=none; d=google.com; s=arc-20160816; b=KNHzJVhj5jRhvupZPKbDJrCSmK8KIYkVFslrh7DbMJDVcRA1qKHAFv2fTNLfh5OliR vnlSeMHbCcRdv+7UWLeAuF1Uibq0CGE8Oe/2v3g9IcXd47jcT5yoDosvwiTBdB5TUFCs piTVUho/8Ep/n6lTLPvQrKr14FhnLprr82S6kkMXNmal2EBlsGbChqFcYO6n710Nj9Qd o7jlCioR83dwjfZxz4AnDOlUrSRyrbqJUiOee5r02YxePPGErEuR6oT1/e2a6VAUKqW8 kd9fcVJAymdFHTJ885KXOtdB4dnDJAV14nYeFr0EIp/Zrhf6xQAGmvwZl2TPUYD9Ywt0 VRQg== 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=DC7OmP8RYhtNikXUkkakqQSZWCGcA7NloIUUTtzntIM=; b=TE8nWaPramsiEQzdsxZouivcjh56FAH6tuZoWSBIsyV5h4vuJkI/H6YMi2etA0ExZ9 qoJYvfxmOgMdMW8eFsdDLL9nVcUaxxp4ej7fF0Ww/ftl9Pl7H1OOVjqIgziZ1gDA7SwJ ZCxJUeQXTKnhJ/FtRxb4DJPiiTmj1hAQ579aWQxPM5wmY+36l0h8VPzbYJC7HoMAr+dN 1a+j/rVWTxT01DtQ/E37leNm8rewd+qtrI2iKERZ55/VY4rpESEuB6oMpyF7b0biqfvH bV4vS7QLqtPANUInFPFfIP6P+Jjd1PhNc9MsL5TE6jTftFakBemyem5/Ea7e6SFzjts3 YDcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=peCfvM1h; 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 q23si1274634otg.271.2020.03.19.06.33.11; Thu, 19 Mar 2020 06:33:24 -0700 (PDT) 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=peCfvM1h; 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 S1728305AbgCSNPS (ORCPT + 99 others); Thu, 19 Mar 2020 09:15:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:35020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728435AbgCSNPP (ORCPT ); Thu, 19 Mar 2020 09:15:15 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 AF15A20724; Thu, 19 Mar 2020 13:15:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584623715; bh=lTJ/hevi2Fpxe8gohbznTq9UURuuyOF+S5hRr9kQW6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=peCfvM1honIRGcQPPyRIo7p91tTabpKLgOeaqXdVN0K1i8cLb6esZlRxebq1ilRlA EzV4xuaT8X02N/2gH2DhwCGW8d9HVPP40dhSyjxxl2aEVRM1tMH8uaKw8Ag3M5axwP o2g8BhYR0VGPtmb6gCVkisIzJ8i6eh1h0ALaE5Hw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Heiner Kallweit , Florian Fainelli , "David S. Miller" Subject: [PATCH 4.14 28/99] net: phy: fix MDIO bus PM PHY resuming Date: Thu, 19 Mar 2020 14:03:06 +0100 Message-Id: <20200319123950.287587516@linuxfoundation.org> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200319123941.630731708@linuxfoundation.org> References: <20200319123941.630731708@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Heiner Kallweit [ Upstream commit 611d779af7cad2b87487ff58e4931a90c20b113c ] So far we have the unfortunate situation that mdio_bus_phy_may_suspend() is called in suspend AND resume path, assuming that function result is the same. After the original change this is no longer the case, resulting in broken resume as reported by Geert. To fix this call mdio_bus_phy_may_suspend() in the suspend path only, and let the phy_device store the info whether it was suspended by MDIO bus PM. Fixes: 503ba7c69610 ("net: phy: Avoid multiple suspends") Reported-by: Geert Uytterhoeven Tested-by: Geert Uytterhoeven Signed-off-by: Heiner Kallweit Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/phy/phy_device.c | 6 +++++- include/linux/phy.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -125,6 +125,8 @@ static int mdio_bus_phy_suspend(struct d if (!mdio_bus_phy_may_suspend(phydev)) return 0; + phydev->suspended_by_mdio_bus = true; + return phy_suspend(phydev); } @@ -133,9 +135,11 @@ static int mdio_bus_phy_resume(struct de struct phy_device *phydev = to_phy_device(dev); int ret; - if (!mdio_bus_phy_may_suspend(phydev)) + if (!phydev->suspended_by_mdio_bus) goto no_resume; + phydev->suspended_by_mdio_bus = false; + ret = phy_resume(phydev); if (ret < 0) return ret; --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -372,6 +372,7 @@ struct phy_c45_device_ids { * is_pseudo_fixed_link: Set to true if this phy is an Ethernet switch, etc. * has_fixups: Set to true if this phy has fixups/quirks. * suspended: Set to true if this phy has been suspended successfully. + * suspended_by_mdio_bus: Set to true if this phy was suspended by MDIO bus. * sysfs_links: Internal boolean tracking sysfs symbolic links setup/removal. * loopback_enabled: Set true if this phy has been loopbacked successfully. * state: state of the PHY for management purposes @@ -410,6 +411,7 @@ struct phy_device { bool is_pseudo_fixed_link; bool has_fixups; bool suspended; + bool suspended_by_mdio_bus; bool sysfs_links; bool loopback_enabled;