Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 462A3C433EF for ; Thu, 24 Feb 2022 16:29:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229680AbiBXQaU (ORCPT ); Thu, 24 Feb 2022 11:30:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229619AbiBXQaN (ORCPT ); Thu, 24 Feb 2022 11:30:13 -0500 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 04B951E112A for ; Thu, 24 Feb 2022 08:29:41 -0800 (PST) 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=iKQ+ddk7h+ceocwkB0iQA76XDs7dCxfpVMw7+eotZNI=; b=Yeb0UC+yy2Eo7Me0QJMPnpBLpf lO7+n6iWIhEGXv5x9J6zXTwL1tf+ioL4MNq/h1c2C1eW/dCyKOxxTznlv4xD7lDa+oYCVVkFIJE9t xiy0uUeqHmtXsGsQkKaCEs8jmagXGPVW1uaO8B+HWivaa7Tkl496++2WnhBpiMdGBMUe2UNRhQxeY xqm6WefZvr0caWzKqHXnogGDrs+pR80xuwsIhtZkwVnu+WNDoJkM8z4kgjZL3crGT8lvEyZndLBol YG5g9ecc7uGG7/z/67cqNCN7DQCuZ3ZmJTJLOvAP/jgY0XyHGVMW0NH86FpjKQP8OWsCKTm3GwrMd ZKnPF0cQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:39182 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nNGm6-0004CR-Ph; Thu, 24 Feb 2022 16:15:26 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nNGm6-00AOip-6r; Thu, 24 Feb 2022 16:15:26 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Vladimir Oltean Cc: Marek Beh__n , Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org Subject: [PATCH RFC net-next 3/6] net: dsa: sja1105: use .mac_select_pcs() interface MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Thu, 24 Feb 2022 16:15:26 +0000 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Convert the PCS selection to use mac_select_pcs, which allows the PCS to perform any validation it needs, and removes the need to set the PCS in the mac_config() callback, delving into the higher DSA levels to do so. Signed-off-by: Russell King (Oracle) --- drivers/net/dsa/sja1105/sja1105_main.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c index e278bd86e3c6..b5c36f808df1 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -1358,18 +1358,16 @@ static int sja1105_adjust_port_config(struct sja1105_private *priv, int port, return sja1105_clocking_setup_port(priv, port); } -static void sja1105_mac_config(struct dsa_switch *ds, int port, - unsigned int mode, - const struct phylink_link_state *state) +static struct phylink_pcs * +sja1105_mac_select_pcs(struct dsa_switch *ds, int port, phy_interface_t iface) { - struct dsa_port *dp = dsa_to_port(ds, port); struct sja1105_private *priv = ds->priv; - struct dw_xpcs *xpcs; - - xpcs = priv->xpcs[port]; + struct dw_xpcs *xpcs = priv->xpcs[port]; if (xpcs) - phylink_set_pcs(dp->pl, &xpcs->pcs); + return &xpcs->pcs; + + return NULL; } static void sja1105_mac_link_down(struct dsa_switch *ds, int port, @@ -3137,7 +3135,7 @@ static const struct dsa_switch_ops sja1105_switch_ops = { .port_max_mtu = sja1105_get_max_mtu, .phylink_get_caps = sja1105_phylink_get_caps, .phylink_validate = sja1105_phylink_validate, - .phylink_mac_config = sja1105_mac_config, + .phylink_mac_select_pcs = sja1105_mac_select_pcs, .phylink_mac_link_up = sja1105_mac_link_up, .phylink_mac_link_down = sja1105_mac_link_down, .get_strings = sja1105_get_strings, -- 2.30.2