From patchwork Fri May 8 12:35:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 226194 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D3BAC38A2A for ; Fri, 8 May 2020 12:57:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E325324958 for ; Fri, 8 May 2020 12:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942646; bh=tIxpfOA4unSyFcuBwL1ysoSVx3S9UkoYppubKOKbt1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Ko67o/Ttt0DYvwQBClZ2OmEDUo0tIz8IQt7MhGf6B+roL82N9zWPdSrl7RSjAAWJq Lm7xxzJOdi8/6P8x0d8VHgIZwsjBk/wvtM2wAvkvrx5jFpUlzJN/nR+is0ahVl+JIb 9MvKYU/Ir0gWJiOiKgxu9JMdVbOVVEJmEiZBr7FQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730341AbgEHMzn (ORCPT ); Fri, 8 May 2020 08:55:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:38732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730086AbgEHMzh (ORCPT ); Fri, 8 May 2020 08:55:37 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1C51D2495A; Fri, 8 May 2020 12:55:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942537; bh=tIxpfOA4unSyFcuBwL1ysoSVx3S9UkoYppubKOKbt1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b946f0SwPwdIfehegOUcZP30BCseo/uxenRMH9LiW+p3c6msY++ycP2leTeJoMbfy +V1MlS2b0AOo4tRf5BXpFmLDl+LdcG/DwRSqnNdzxgKBQDBK/YyHqu+/kdkCis2dOH X4etUSNWfhDnfed6ZTbYtubLzvDv+ENlpFKE6tW0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , "David S. Miller" , Sasha Levin Subject: [PATCH 5.6 35/49] net: phy: bcm84881: clear settings on link down Date: Fri, 8 May 2020 14:35:52 +0200 Message-Id: <20200508123048.022211521@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508123042.775047422@linuxfoundation.org> References: <20200508123042.775047422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Russell King [ Upstream commit 796a8fa28980050bf1995617f0876484f3dc1026 ] Clear the link partner advertisement, speed, duplex and pause when the link goes down, as other phylib drivers do. This avoids the stale link partner, speed and duplex settings being reported via ethtool. Signed-off-by: Russell King Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/phy/bcm84881.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/bcm84881.c b/drivers/net/phy/bcm84881.c index 14d55a77eb28a..1260115829283 100644 --- a/drivers/net/phy/bcm84881.c +++ b/drivers/net/phy/bcm84881.c @@ -174,9 +174,6 @@ static int bcm84881_read_status(struct phy_device *phydev) if (phydev->autoneg == AUTONEG_ENABLE && !phydev->autoneg_complete) phydev->link = false; - if (!phydev->link) - return 0; - linkmode_zero(phydev->lp_advertising); phydev->speed = SPEED_UNKNOWN; phydev->duplex = DUPLEX_UNKNOWN; @@ -184,6 +181,9 @@ static int bcm84881_read_status(struct phy_device *phydev) phydev->asym_pause = 0; phydev->mdix = 0; + if (!phydev->link) + return 0; + if (phydev->autoneg_complete) { val = genphy_c45_read_lpa(phydev); if (val < 0)