Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2835404pxb; Mon, 1 Nov 2021 02:51:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgh4AcTh+ZfBMbOOLKS4bjUOaomlq8eeRqLvACZSx7yfjITvY+pZpGg7SVjQlq4kXxf1hd X-Received: by 2002:a05:6402:158:: with SMTP id s24mr40004654edu.189.1635760305666; Mon, 01 Nov 2021 02:51:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635760305; cv=none; d=google.com; s=arc-20160816; b=cTm2xiOZX6LzLDPCM0VBAI9f0ORwYOyXUtGJ9divs3Ciy2Li+pNiONFeITcApFgAHu F/UxIcu5BtQUQlBzxc1EGnqO9kPdJxRpQUDkOjxbM3oK7RabQMEOMtAt7ux5YGASv7Ml fp9DQE9knVpEKw20pPUuQP1pYItqeRpyy0FXVg9+9UrS8kVtobkT0NhNn4VF8ezPzSSv jtILsdEGdxrZDsfb6W/9Z5z56+bo02iGvDOfk55Db36TOvY6XYrofFGtryiJA0WX2EAd y+kgthqJAH3N7ZkrIBSv3VE4oR5a4aUVPivV7u5xDCH1WbaBlk1l7W7MyEn7vDvVSCOF q6nQ== 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=sM9FrLguiFV+35GYn1Qq/tXArwZe+xjo009aAsoydDg=; b=Gu2tleLqD0S735piDgU6HYXNinU5wWcJfKhx/LrFFvbX5jz8J/vprEY+fSukGKOIsl j3BgEmB3h1FXwumFEEbzb4zqhVuJtu1Ko6qewzTDnQVHWPmkP8xuqalpDLMsGgVCGKID HvObdg18sD7q3haJuveM1Ic83JzkZbmlLoJZWyS/kix3/e05oXzD9p9tJiX66Z7POeWg Ta5noum0DxTg6zr79UMiOggUrh2SWqet0j44YP8cCT7Qja4lktkfYYLs7IelXGSs/9Ql vIvD6w3xbbxLIRd+l45YbySynCjDvPRQHFbwhavt3Nk/3JXTmr0zACLpiqLh5nStCgX/ EgxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M3vkENht; 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 sd2si1809447ejc.122.2021.11.01.02.51.21; Mon, 01 Nov 2021 02:51:45 -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=M3vkENht; 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 S232689AbhKAJwA (ORCPT + 99 others); Mon, 1 Nov 2021 05:52:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:51432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234127AbhKAJrW (ORCPT ); Mon, 1 Nov 2021 05:47:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D741261406; Mon, 1 Nov 2021 09:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635759052; bh=ATBsLN0XtI/+FNx8UYR94fhcNhcWjLUiML3YLjYCQoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M3vkENhtiYDKCM8PDTHeVmym0OBljnmfXzXYCLUp7vyKhsxabJ01NOYDMxtz/qVJn YC4qV+fmJepvZMHA7O9EclbxZN7HgwJD2Z0i98MDoqD0uZH+yykLh3KpD98KlaYEZd FzmSyrLGYFOzRd0AgDvg1s51oowzYvQeoNX5cvkI= 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.14 094/125] phy: phy_start_aneg: Add an unlocked version Date: Mon, 1 Nov 2021 10:17:47 +0100 Message-Id: <20211101082550.941197352@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082533.618411490@linuxfoundation.org> References: <20211101082533.618411490@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 @@ -700,7 +700,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 @@ -708,25 +708,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;