From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-cys01nam02on0128.outbound.protection.outlook.com ([104.47.37.128]:6976 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932578AbeCSPrT (ORCPT ); Mon, 19 Mar 2018 11:47:19 -0400 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Fuyun Liang , Peng Li , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 014/124] net: hns3: fix for getting auto-negotiation state in hclge_get_autoneg Date: Mon, 19 Mar 2018 15:47:12 +0000 Message-ID: <20180319154645.11350-14-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Fuyun Liang [ Upstream commit 27b5bf49f0924fd62d2b1ef8467b40773973da34 ] When phy exists, we use the value of phydev.autoneg to represent the auto-negotiation state of hardware. Otherwise, we use the value of mac.autoneg to represent it. This patch fixes for getting a error value of auto-negotiation state in hclge_get_autoneg(). Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibili= ty Layer Support") Signed-off-by: Fuyun Liang Signed-off-by: Peng Li Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/driv= ers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 59ed806a52c3..3a3c7fe50e13 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2189,6 +2189,10 @@ static int hclge_get_autoneg(struct hnae3_handle *ha= ndle) { struct hclge_vport *vport =3D hclge_get_vport(handle); struct hclge_dev *hdev =3D vport->back; + struct phy_device *phydev =3D hdev->hw.mac.phydev; + + if (phydev) + return phydev->autoneg; =20 hclge_query_autoneg_result(hdev); =20 --=20 2.14.1