Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2829476pxb; Mon, 1 Nov 2021 02:42:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnYJaGJXt3QwG5YWdJbOyAKsrtofLHkjwcUKJEtfjf7BMswFjhRJ5ig2ZmQnF4w/M3pF4P X-Received: by 2002:a17:906:f41:: with SMTP id h1mr36629442ejj.255.1635759756754; Mon, 01 Nov 2021 02:42:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635759756; cv=none; d=google.com; s=arc-20160816; b=GECn+z8BUOJUnHKCdk5TRvobiHRlWqMb9FE8UDsMq2+2xT4YA37qRoBRShceTYnbwo Xup29+C/zQ1/Ycl9v6WIbdVswWosWlR+zcMPKsb35xYX4kMeIEVdScUddl5+k2kI9WvJ cK5QvDhnmUky7hAxcpaCqVW/PtmsOcFthK4bqH93NCOLtG4tbVrD0dpiDaxLBjkKc5Mw oOqsBxtkD2OXjtH/+a0DLaO0o7xPwQlzEUSTzg8aFciy/KKAlOcjRu/18iUpJjvk/lk8 M5iwb75PmuXjNHfxELfaMj1YV/MQz6G4lJdsQWWvz7F39+e1CxBD1w3IPg6ZEJRp00GY 97Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NKFCwXQzKoRZXj5sx8rK3rnW9omvJprDbTBB8tgTS3o=; b=n5w6a+QJXLZS3OC/CjFQfd8QRt36VagsF+2S2i5PtO29VDqAkbM0BojhpY4hmz7wXv GLHhO0X57S5s0ssnUBwdg6YAH36DcEi+6ic97vviD8EynjEcBHr/GXeqZrWVRBrxjyWb OqFSJy1ddls8G+esMdfn3bikiYi55p95DOTDqoWRlXU+rgGc2J+RDRBn8jWEhbk85cld NhK9Yl4yKkT1rBziLkbGX05CMCeEkEBpfOVhxU6HzTVVq6CEWVQts3gt4Y/AeoUbOSzk osgPNIjGntRyUlnvADDPy6j5kUs2EIUi7gFT3oLuX9614DYcB3qRJTcfb8pDqoawtQrc wQPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0/hel4Fj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i11si25295669edb.538.2021.11.01.02.42.13; Mon, 01 Nov 2021 02:42:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0/hel4Fj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233270AbhKAJkK (ORCPT + 99 others); Mon, 1 Nov 2021 05:40:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:43568 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232792AbhKAJhr (ORCPT ); Mon, 1 Nov 2021 05:37:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E84486128C; Mon, 1 Nov 2021 09:26:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635758800; bh=95cYhKU0K9kArwLyJ6CTAuDxTrmT/fvCFbnpK/u8Y34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0/hel4FjS+go8niOMFh6LQFtpvPm8EGvSRTBz7J6R171hjjnzYOLKLpKXWjjNmBdT cOemeO9apX5UKc6HRCT+jvg99scyW/MpveyoY83E9+nQ+63n2zRy2nrXzlTQ/cvny8 CLhuHBtvs0E4+ZrfiJixDHa5IKvxTm63L6mPIFhQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Lunn , "David S. Miller" Subject: [PATCH 5.10 63/77] phy: phy_start_aneg: Add an unlocked version Date: Mon, 1 Nov 2021 10:17:51 +0100 Message-Id: <20211101082524.873535463@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082511.254155853@linuxfoundation.org> References: <20211101082511.254155853@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrew Lunn commit 707293a56f95f8e7e0cfae008010c7933fb68973 upstream. Split phy_start_aneg into a wrapper which takes the PHY lock, and a helper doing the real work. This will be needed when phy_ethtook_ksettings_set takes the lock. Fixes: 2d55173e71b0 ("phy: add generic function to support ksetting support") Signed-off-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/phy/phy.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -716,7 +716,7 @@ static int phy_check_link_status(struct } /** - * phy_start_aneg - start auto-negotiation for this PHY device + * _phy_start_aneg - start auto-negotiation for this PHY device * @phydev: the phy_device struct * * Description: Sanitizes the settings (if we're not autonegotiating @@ -724,25 +724,43 @@ static int phy_check_link_status(struct * If the PHYCONTROL Layer is operating, we change the state to * reflect the beginning of Auto-negotiation or forcing. */ -int phy_start_aneg(struct phy_device *phydev) +static int _phy_start_aneg(struct phy_device *phydev) { int err; + lockdep_assert_held(&phydev->lock); + if (!phydev->drv) return -EIO; - mutex_lock(&phydev->lock); - if (AUTONEG_DISABLE == phydev->autoneg) phy_sanitize_settings(phydev); err = phy_config_aneg(phydev); if (err < 0) - goto out_unlock; + return err; if (phy_is_started(phydev)) err = phy_check_link_status(phydev); -out_unlock: + + return err; +} + +/** + * phy_start_aneg - start auto-negotiation for this PHY device + * @phydev: the phy_device struct + * + * Description: Sanitizes the settings (if we're not autonegotiating + * them), and then calls the driver's config_aneg function. + * If the PHYCONTROL Layer is operating, we change the state to + * reflect the beginning of Auto-negotiation or forcing. + */ +int phy_start_aneg(struct phy_device *phydev) +{ + int err; + + mutex_lock(&phydev->lock); + err = _phy_start_aneg(phydev); mutex_unlock(&phydev->lock); return err;