From patchwork Tue Jul 21 11:03:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 1332938 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.a=rsa-sha256 header.s=pandora-2019 header.b=a8j5YSLC; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4B9wh92pgdz9sR4 for ; Tue, 21 Jul 2020 21:03:53 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729460AbgGULDw (ORCPT ); Tue, 21 Jul 2020 07:03:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727043AbgGULDw (ORCPT ); Tue, 21 Jul 2020 07:03:52 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1F6EC061794 for ; Tue, 21 Jul 2020 04:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=nczSUE74lf+1ap8pQxZetQhW9QZgPVi1uJ8T5Zjuu+o=; b=a8j5YSLCo9A6wPZlUXxXrBl3ih u4HvobSAKZaGGliz4FksVssH+ky4HMyiqPKVCrnTRSgOEc76l9AOCED4ShflO5VZyCLxvU0NoUvum u9XGUJYQr/2LTACTbTzZong58aEiNep9Sny/u2h/sXDA12t+bOSs8OOFGzgLC8gqLZti8uP1xv8KO z0FPT6M0yxG1YelrVn4OK7fUZrDwHZoPOzON5hNIEt6I3nLaEbMOy8FKy/SHs6hVNYxqN2XJdg5Lm kYNNsiqdqp7riiEnPrMRnhuMPxT4hrV2+/Bkda5Q5haaCEjvqFZsxQMW5B8X5xOqaZlqm502cKoex sbyDQwng==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:41756 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxq3q-0004EH-M5; Tue, 21 Jul 2020 12:03:50 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1jxq3q-0004R2-FK; Tue, 21 Jul 2020 12:03:50 +0100 In-Reply-To: <20200721110152.GY1551@shell.armlinux.org.uk> References: <20200721110152.GY1551@shell.armlinux.org.uk> From: Russell King To: Andrew Lunn , Florian Fainelli , Heiner Kallweit , Ioana Ciornei Cc: "David S. Miller" , netdev@vger.kernel.org, Alexandru Marginean , Claudiu Manoil , "michael@walle.cc" , "olteanv@gmail.com" , Vladimir Oltean , Jakub Kicinski Subject: [PATCH net-next 02/14] net: phylink: rejig link state tracking MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 21 Jul 2020 12:03:50 +0100 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Rejig the link state tracking, so that we can use the current state in a future patch. Reviewed-by: Florian Fainelli Signed-off-by: Russell King --- drivers/net/phy/phylink.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 0fd5a11966aa..b36e0315f0b1 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -578,9 +578,14 @@ static void phylink_resolve(struct work_struct *w) struct phylink *pl = container_of(w, struct phylink, resolve); struct phylink_link_state link_state; struct net_device *ndev = pl->netdev; - int link_changed; + bool cur_link_state; mutex_lock(&pl->state_mutex); + if (pl->netdev) + cur_link_state = netif_carrier_ok(ndev); + else + cur_link_state = pl->old_link_state; + if (pl->phylink_disable_state) { pl->mac_link_dropped = false; link_state.link = false; @@ -623,12 +628,7 @@ static void phylink_resolve(struct work_struct *w) } } - if (pl->netdev) - link_changed = (link_state.link != netif_carrier_ok(ndev)); - else - link_changed = (link_state.link != pl->old_link_state); - - if (link_changed) { + if (link_state.link != cur_link_state) { pl->old_link_state = link_state.link; if (!link_state.link) phylink_link_down(pl);