Received: by 10.213.65.68 with SMTP id h4csp507858imn; Fri, 16 Mar 2018 09:53:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELvo5WWFvlO3FSPBJv1gojVkG9S0tjLe0NX/1EkDMHhq4O5pWeys28cvjC1Gi2Vs1+4ukkcH X-Received: by 2002:a17:902:4201:: with SMTP id g1-v6mr2922785pld.62.1521219180746; Fri, 16 Mar 2018 09:53:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521219180; cv=none; d=google.com; s=arc-20160816; b=bG1Rl5JgAb28OHILAOnwwXP0a7p6wYZP8JQ86OzEzEeJfJcSvbp8wr+yJqobpETuZH 9UAUfAbAD2Ql81pyflO4XiQgE+fWzgFQWS1iYtRgusjxef161/+Nso9OQGcHrhTqsgJp r4Albr2OyxP/7a54/VglzIb0WBsSvdGgalmBLdcj86//SvVGeHnWwZ/XhKPCOnJWPPQd ywoonvvoOqVIlb+lF3m0AqZ7QEz1HaDoBdWW43hli5rFOQSDZPWAOevwGf0BCrdPsNVa +zhmEuPw7GZiSxhjoOYq5xw2Q+8dW17KdDHKF0S8AEWh+Bgr+2WwQoI839FEaReifyzV rzVg== 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=/+WrHXjhqle3ZnRpw9Ly6D4QuEqVXSWCYEufJ7ywMm4=; b=a7QqI4CubdhUKa+j47KFLufgFiPyUsZAYoNEDWnPp87XcIJa/ZhWE5HwLjLGY/+I4Q tDk7W9CKLgQQvsQkz5fusLzEvrdjUAKgzc3AdxWixHjto+A63/tbDheFTUk7q/ycUoT9 z93V44vz98dJZfp66U4gcP/ipZkYmLmcqg7g3TQxZETU/blQK4blI3m2sfhgW/HpnSUg HO+qc/JprKh57IQ4mp0T3FBP20D+v/+5LCMkSsxaICs21QnVP3k1WSQ9DZzOL1Arf7Mx hxIizUp31N83r4YN9m3Nn+PZE92ziETm93BKDL3qrAxSPFZYtwArrcw90Bc06WbzgJxA qFEA== 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 p66si4864781pfk.100.2018.03.16.09.52.46; Fri, 16 Mar 2018 09:53:00 -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; 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 S1752950AbeCPQvh (ORCPT + 99 others); Fri, 16 Mar 2018 12:51:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:39494 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933979AbeCPPee (ORCPT ); Fri, 16 Mar 2018 11:34:34 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DF336FED; Fri, 16 Mar 2018 15:34:33 +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.14 002/109] net: phy: Restore phy_resume() locking assumption Date: Fri, 16 Mar 2018 16:22:31 +0100 Message-Id: <20180316152329.963710543@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152329.844663293@linuxfoundation.org> References: <20180316152329.844663293@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andrew Lunn commit 9c2c2e62df3fa30fb13fbeb7512a4eede729383b upstream. 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 @@ -817,6 +817,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);