Received: by 10.223.185.116 with SMTP id b49csp5481804wrg; Wed, 7 Mar 2018 12:31:39 -0800 (PST) X-Google-Smtp-Source: AG47ELtlxuX1G5kzaOb4hojKklzCeu5lZWbfe2tLo8nnSUmPfVWyKQaKRJYlMTWyrXnXmrsY2h5p X-Received: by 10.99.115.73 with SMTP id d9mr19753582pgn.354.1520454699740; Wed, 07 Mar 2018 12:31:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520454699; cv=none; d=google.com; s=arc-20160816; b=hzBr71+5wfE/D6LMdF4Lw4h6l1W/p6hk5w4sXg+QzgveAZePyclFKKHzcmSqScn3zZ wyEQrXD0LgmfvPpDSeljD0aiT0JsEwhhZWO+QwYXidevqbKzrgWFr1BzvqTS0dcYcNWH 2ky9iztNFsRivJ5NxyAjcXXw/pKn4SBXYyXG0ji8BlDc4fjEaBnJCFtruv6KhWfT9jsk bIorp2C4KX835fvvvTCsUYL2q02b3VJJ4wZs2x8EVfc1Yx2LEFzSuiIU+Mp3Bo+j//bs dbKfNHPOWx4nlnVM3rBCa2KF9yMFHxDt+UXxIUdr0iPvetz8zEMTjjvIDFan+8dXT2p4 LLCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=i9yYyYmwMqhKb1S+jQmN4/D1mHbZWCJwSynLJKeRNpc=; b=zncLBkzPoqVgZ4VIS/ycD7E/daG+GWQ1e4xm3fNNJIJ10IcEiNv11irI38fKSLo2I/ NKqe8ccM2dbWpiC71tXdpSvrw6Xwlm0/V3mScZqBJsnEDCd0XIiH+9f2M3LJhuQea1sA iw9ifiqnw4JdLpnNsqfjmUZL9CvMUbNShga6BuhVsW9SHuy7MdhcDHZ69IePTMWKf+PM nox5olE1WcbkY7LSnw/pCQ0ygBlyfzmfSz5EfivoEJaaSTmpBCwN3cgqidAUd+Vcx8nZ tmM1K7YZ1NamjqZWcdO056GTKjkBSFoYIJdPr7MWdHgU6n66egKMN8eRpCuQ5aQm7fDM 01yw== 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 c4si11778018pgu.355.2018.03.07.12.31.24; Wed, 07 Mar 2018 12:31:39 -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 S934944AbeCGUaW (ORCPT + 99 others); Wed, 7 Mar 2018 15:30:22 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:42454 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964796AbeCGTma (ORCPT ); Wed, 7 Mar 2018 14:42:30 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 37C9C1070; Wed, 7 Mar 2018 19:42:25 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiner Kallweit , Andrew Lunn , Florian Fainelli , "David S. Miller" Subject: [PATCH 4.15 081/122] net: phy: Restore phy_resume() locking assumption Date: Wed, 7 Mar 2018 11:38:13 -0800 Message-Id: <20180307191740.978694395@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191729.190879024@linuxfoundation.org> References: <20180307191729.190879024@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andrew Lunn [ Upstream commit 9c2c2e62df3fa30fb13fbeb7512a4eede729383b ] commit f5e64032a799 ("net: phy: fix resume handling") changes the locking semantics for phy_resume() such that the caller now needs to hold the phy mutex. Not all call sites were adopted to this new semantic, resulting in warnings from the added WARN_ON(!mutex_is_locked(&phydev->lock)). Rather than change the semantics, add a __phy_resume() and restore the old behavior of phy_resume(). Reported-by: Heiner Kallweit Fixes: f5e64032a799 ("net: phy: fix resume handling") Signed-off-by: Andrew Lunn Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/phy/phy.c | 2 +- drivers/net/phy/phy_device.c | 18 +++++++++++++----- include/linux/phy.h | 1 + 3 files changed, 15 insertions(+), 6 deletions(-) --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -841,7 +841,7 @@ void phy_start(struct phy_device *phydev break; case PHY_HALTED: /* if phy was suspended, bring the physical link up again */ - phy_resume(phydev); + __phy_resume(phydev); /* make sure interrupts are re-enabled for the PHY */ if (phy_interrupt_is_valid(phydev)) { --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -135,9 +135,7 @@ static int mdio_bus_phy_resume(struct de if (!mdio_bus_phy_may_suspend(phydev)) goto no_resume; - mutex_lock(&phydev->lock); ret = phy_resume(phydev); - mutex_unlock(&phydev->lock); if (ret < 0) return ret; @@ -1028,9 +1026,7 @@ int phy_attach_direct(struct net_device if (err) goto error; - mutex_lock(&phydev->lock); phy_resume(phydev); - mutex_unlock(&phydev->lock); phy_led_triggers_register(phydev); return err; @@ -1156,7 +1152,7 @@ int phy_suspend(struct phy_device *phyde } EXPORT_SYMBOL(phy_suspend); -int phy_resume(struct phy_device *phydev) +int __phy_resume(struct phy_device *phydev) { struct phy_driver *phydrv = to_phy_driver(phydev->mdio.dev.driver); int ret = 0; @@ -1173,6 +1169,18 @@ int phy_resume(struct phy_device *phydev return ret; } +EXPORT_SYMBOL(__phy_resume); + +int phy_resume(struct phy_device *phydev) +{ + int ret; + + mutex_lock(&phydev->lock); + ret = __phy_resume(phydev); + mutex_unlock(&phydev->lock); + + return ret; +} EXPORT_SYMBOL(phy_resume); int phy_loopback(struct phy_device *phydev, bool enable) --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -819,6 +819,7 @@ void phy_device_remove(struct phy_device int phy_init_hw(struct phy_device *phydev); int phy_suspend(struct phy_device *phydev); int phy_resume(struct phy_device *phydev); +int __phy_resume(struct phy_device *phydev); int phy_loopback(struct phy_device *phydev, bool enable); struct phy_device *phy_attach(struct net_device *dev, const char *bus_id, phy_interface_t interface);