Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp526131qtg; Wed, 5 Apr 2023 13:42:12 -0700 (PDT) X-Google-Smtp-Source: AKy350ZdwR6Wsrlzt/vWRvERwzlRYxjd/cotS0svtQxBTtEYW3uy+r4pEPa2Vg/3z6njbfTizxWg X-Received: by 2002:a17:906:110d:b0:889:1eb1:7517 with SMTP id h13-20020a170906110d00b008891eb17517mr3897764eja.30.1680727332358; Wed, 05 Apr 2023 13:42:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680727332; cv=none; d=google.com; s=arc-20160816; b=d3oXgQj+ip8z8RO03C8JC+2A1gtkXqhgG96Pt+s64zjtzsaoYQIN3GhSYaJi02RBIE IQXubCv04GE/zgjKEn711FcqyM2FK6Ts2SqxIGyG/apQoddsRO4iGQUMY4B0yDMcZkyZ 8RNPWVsuctlmZA/xXvJTNnIZoUsjHZXKo1NyASu9O6L0PI2Fjw6iiiL3eauZh/byMx+v 4StW7Lv25fv3/qdTtQ0v3kI+gqrBpTP0lE4vOr/EGWCAf9c1xWSRRFJ6DEBvDVwp2dOK avJem52VZ0/diphytbWLmTS1grnWH31+sV+6GaoOCHV8fz1X2fa8jKaIxId+AWzgUjAR EXmw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ry2z2xzBFl6Ly3vSlf60f+roED9HAgz7ua4fkZgzGE0=; b=UVoo9utTUky8HEQJaD/dA2u0tqDbEJsB94CrIIHspKyXXbf+hPvAsU2CE6ixuc75dt xZAqVHCgGLm87Oxn6zdh84mSp3JvfOPDcKcrBDiUtoxOGdd+lCTqs77OqVDm7C0MzeJ1 eiG54W4Q6BntZPZO6mlPPkEGLhphlwzyJ3aCtrAIY2vhOTKg8qAugJdBWCzu3Uc2cGA8 CuXtnYonaG0K0hrYnrlmx42IxWfwzgKCO9DTdxljVSLtUnZijr2INI9cxT/qdIIZnVG4 3/2sYmV+UYmQ1aeRfK4hZHvqZodRSGz4H9OVElFKD2B8RTXduTiIIgJm90KHygyoj1TX XuCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=B10ji6xo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id og27-20020a1709071ddb00b008dd83608278si46669ejc.933.2023.04.05.13.41.47; Wed, 05 Apr 2023 13:42:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=B10ji6xo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234497AbjDEUju (ORCPT + 99 others); Wed, 5 Apr 2023 16:39:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234117AbjDEUjg (ORCPT ); Wed, 5 Apr 2023 16:39:36 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6C986A44; Wed, 5 Apr 2023 13:39:19 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id m6-20020a05600c3b0600b003ee6e324b19so22722327wms.1; Wed, 05 Apr 2023 13:39:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680727158; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ry2z2xzBFl6Ly3vSlf60f+roED9HAgz7ua4fkZgzGE0=; b=B10ji6xoiT0KxNstoIf5OK4ul/y1PldmpWHRRnHJt1TTMY8uy1Ri+rx+FbMG8mP5nx wTD2y33SyfmX093zp8tIpavy1sb+9KEomRXl/FO+f6xxOC/m9jruqhWPxaIQCdu1LVNf uvT/t3r/to1RYojP7TVRl8ook1fgIpCss11RcOxcLXlUurmJsQbXhBALHRSAFxiVVg5f ymEWzmFrLRRgAiYlmWj3C/y8x2kup19rTBLxrMKnHg+Y4h4mBKBFP6Nb/S9p9nmqCFSs KocXGXZdx8t7MCkX7DZ82p2f7imGHXztIQEeRqlIiNfvyu1RFK2Do2NIrLimLMw8Z5ff bpIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680727158; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ry2z2xzBFl6Ly3vSlf60f+roED9HAgz7ua4fkZgzGE0=; b=qWpyjiwgC0OjPptaSUwhq9JuEnu8lum84Nnm8CllOTYCRdlu+2OaUs7c4czK09K/Cn +lB4bVkrL3XUcG42oF0S4ylcuPODEJHyHwt10nX6hR0Lh2CHLpcxQSIRmdfSiJB1Rfd4 YiWnVe5RHV+3x92FcqnpbLBvgxvDXOJo3KXf0m5f1M5glK8mZGOBlf2g1k4jJhTppRFV dpgh3yZCPHyFi0u9X3+YywMHhlN0Rl4+JrXMIbGgUaziXhSapFhYPU6Otjyf3rvCikly /VzQi8hzGLLOABTiecRdCaj5NSO6tM7I3Cld6VTo/x7M8b6/YFuSyz41eJBW2fFg+pss CqAw== X-Gm-Message-State: AAQBX9cDdB2Uo0jOtjIJMcM5p8d/DgFK80kLYNHAky8Nxy1E81nSg419 hy1vYXEPQwv7fToPFF8X2cg= X-Received: by 2002:a05:600c:ace:b0:3ed:ea48:cd92 with SMTP id c14-20020a05600c0ace00b003edea48cd92mr5970347wmr.15.1680727158320; Wed, 05 Apr 2023 13:39:18 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id p19-20020a05600c469300b003eda46d6792sm3259867wmo.32.2023.04.05.13.39.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 13:39:17 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: =?UTF-8?q?Ren=C3=A9=20van=20Dorst?= , Sean Wang , Landen Chao , DENG Qingfang , Daniel Golle , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King Cc: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , Ilya Lipnitskiy , Richard van Schagen , Richard van Schagen , Frank Wunderlich , erkin.bozoglu@xeront.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [RFC PATCH net-next 06/12] net: dsa: mt7530: do not set CPU port interfaces to PHY_INTERFACE_MODE_NA Date: Wed, 5 Apr 2023 23:38:53 +0300 Message-Id: <20230405203859.391267-7-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230405203859.391267-1-arinc.unal@arinc9.com> References: <20230405203859.391267-1-arinc.unal@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arınç ÜNAL There is no need to set priv->p5_interface and priv->p6_interface to PHY_INTERFACE_MODE_NA on mt7530_setup() and mt7531_setup(). As Vladimir explained, in include/linux/phy.h we have: typedef enum { PHY_INTERFACE_MODE_NA, In lack of other initialiser, the first element of an enum gets the value 0 in C. Then, "priv" is allocated by this driver with devm_kzalloc(), which means that its entire memory is zero-filled. So priv->p5_interface and priv->p6_interface are already set to 0, PHY_INTERFACE_MODE_NA. There is no code path between the devm_kzalloc(), and the position in mt7530_setup() and mt7531_setup() that would change the value of priv->p5_interface or priv->p6_interface from 0. The only place they are modified is mt753x_phylink_mac_config() but mt753x_phylink_mac_config() runs after mt753x_setup(), as can be seen on the code path below. mt7530_probe() -> dsa_register_switch() -> dsa_switch_probe() -> dsa_tree_setup() -> dsa_tree_setup_switches() -> dsa_switch_setup() -> ds->ops->setup(): mt753x_setup() -> dsa_tree_setup_ports() -> dsa_port_setup() [...] -> dsa_port_phylink_create() [...] -> phylink_mac_config() -> pl->mac_ops->mac_config(): dsa_port_phylink_mac_config() -> ds->ops->phylink_mac_config(): mt753x_phylink_mac_config() Therefore, do not put 0 into a variable containing 0. Tested-by: Arınç ÜNAL Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 8a47dcb96cdf..fc5428baa905 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2247,8 +2247,6 @@ mt7530_setup(struct dsa_switch *ds) val |= MHWTRAP_MANUAL; mt7530_write(priv, MT7530_MHWTRAP, val); - priv->p6_interface = PHY_INTERFACE_MODE_NA; - /* Enable and reset MIB counters */ mt7530_mib_reset(ds); @@ -2466,10 +2464,6 @@ mt7531_setup(struct dsa_switch *ds) mt7530_rmw(priv, MT7531_GPIO_MODE0, MT7531_GPIO0_MASK, MT7531_GPIO0_INTERRUPT); - /* Let phylink decide the interface later. */ - priv->p5_interface = PHY_INTERFACE_MODE_NA; - priv->p6_interface = PHY_INTERFACE_MODE_NA; - /* Enable PHY core PLL, since phy_device has not yet been created * provided for phy_[read,write]_mmd_indirect is called, we provide * our own mt7531_ind_mmd_phy_[read,write] to complete this -- 2.37.2