Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp880514rwl; Fri, 7 Apr 2023 06:55:29 -0700 (PDT) X-Google-Smtp-Source: AKy350bN5N2oRr7/rQF/jL3cv9YyMM+3bMEnrsOG3pFZtLIZWHGNrCr90IIb+f/SFWpKiGWtFjlu X-Received: by 2002:a17:902:e80c:b0:19d:1d32:fbe with SMTP id u12-20020a170902e80c00b0019d1d320fbemr3606957plg.20.1680875729203; Fri, 07 Apr 2023 06:55:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680875729; cv=none; d=google.com; s=arc-20160816; b=EU/ihtJDQt1nsY8cdLG/vkCqyt7RiNjSfPusrvqs5Orx8KuAO3PSDiHRsCln1gQtWh Um+hziuyMz3eI5Ug/WBGMA2LMyXqpDVygoOrDX+r7TeN1GYGcllE/VsxSUS2jAXzu7OY qPolMHwg1K/KLx+8ut0Qy6pQaC5D/4eUaInBYCniCLckTGX68bFig5GIDB3crSABdAlA V6bOZVySXlMSOo4W0uWXjXWPVEfrRq+QmSRW2dprh6gPgXBxw5CsmdZLTuHOdG+mUonn BQzKB82BfiETz0hydWD/lgyYiljXNI6vEIiFTs9klgZ0kNnPNEUnjr7WJJuGJwI9gqVh UmxA== 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=nVB9ML0qQp6Ot62697wF9RTVP+Z+z2Q4uGeODmUSaHg=; b=pz3/f5kf7YetPBOobuzlxnB2NCqj8w3E8JaMrgPX3bOuWedpubNCJPgZXqYqtCd0BI n8IsLpkRY3tkkq+wGIzOPu9Rv1svp0h492jCcMsDheEnh/lCiQAuZiRO3n3g7xA/oFpe ReTQ7KPot7lpdXBsdJWqCL03+VVlRqK1uxWwaOmYpTolf9ThDS1R5yKCRZc3PHwpS2fl LMhaQUHF59FvJDQuwDs9YQSSDDb2Abh8GVgX+uqnkilOzuIWnrQWy/qWhrSAQKQXet76 KWHADXvp+u4qOXwT4C+zhU8eRjODv7JsKDagL+MD8xEEbfGiJ23V+ZK/e+I29pakyFtm ffrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=i1K1Fdoc; 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 kr5-20020a170903080500b001a1cd4d4237si3714501plb.403.2023.04.07.06.55.17; Fri, 07 Apr 2023 06:55:29 -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=i1K1Fdoc; 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 S233267AbjDGNuo (ORCPT + 99 others); Fri, 7 Apr 2023 09:50:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239814AbjDGNtz (ORCPT ); Fri, 7 Apr 2023 09:49:55 -0400 Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98760B46D; Fri, 7 Apr 2023 06:47:39 -0700 (PDT) Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-54c17fa9ae8so76386017b3.5; Fri, 07 Apr 2023 06:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680875259; 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=nVB9ML0qQp6Ot62697wF9RTVP+Z+z2Q4uGeODmUSaHg=; b=i1K1FdocxtQzLTFUEHSuQBjYbF+13pH0uYQGzYUPZOMq1Iu/dGJPy12Qm6mARCEzCm YHLL/WqShe6RMe50LWVBE77YnhHGRcC1fEN3mEmKn7NDQ0LYUEkBZxKolKnW/1jRh5cf fIrVPtKD1jIC7U69xs4HxVstnyINJxYrt4DUjIdzBJHPwF2ADOt5xzUN0e/J+pWcksyR oviPikrbAOtyY5v0zfDuvdX6p7b5Cz4/hw2hP2Wj7eVatoxYMShivAMISsrG7OP+Asb7 /neG+24jv6/svx9gQZtmBy1JfbrIJYSS9jWZ8RBKUMmXTNPPv2UMMLPCBr0dLBTg8Vus 2Zjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680875259; 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=nVB9ML0qQp6Ot62697wF9RTVP+Z+z2Q4uGeODmUSaHg=; b=fFEMAdtw7SHdVPKpKKTkwQyXCglz8HScHpI7pw/xtDkgfwal8MW2+Nuzdf6WcD+MeW VVKYoA/Vy+/H1PkoEttK/NTHQdxGFATdGa7eiD/5Ft6oKVZ2eMMoluuiVJSsAbC1aKW1 dfAQ8UH2CcpLoSCVNc27S+8GuuSgkvYEvuvnBUYXyuRlr0/FsaQjkS/QaHCnx9d2YPv0 mzWsh0U8EFaEZ5qDsEiHgpvJq+y48ys28t8C7uAHo274HE+uEjR6E3z7PQ+AgS3DnMPp QTAp9oYjvlfAIlozLYxzUKC+ZjsQbr2fsFnhvOjQinpVALmf96GXnXqQ3nvBy8Q3JOSH FmZg== X-Gm-Message-State: AAQBX9eOgySVcYCW/TwF2uuPk/SLQ0KMTxXyUxZ4ElhzHpYHOx2cHNhz A0bLhUFYdEwqjOKrIU//0ms= X-Received: by 2002:a81:5c56:0:b0:544:9180:3104 with SMTP id q83-20020a815c56000000b0054491803104mr1809711ywb.34.1680875258782; Fri, 07 Apr 2023 06:47:38 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id 139-20020a810e91000000b00545a0818473sm1034317ywo.3.2023.04.07.06.47.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Apr 2023 06:47:38 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: 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?= , 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 v2 net-next 14/14] net: dsa: mt7530: remove .mac_port_config for MT7988 and make it optional Date: Fri, 7 Apr 2023 16:46:26 +0300 Message-Id: <20230407134626.47928-15-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230407134626.47928-1-arinc.unal@arinc9.com> References: <20230407134626.47928-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 For the switch on the MT7988 SoC, the code in mac_port_config for MT7988 is not needed as the interface of the CPU port is already handled on mt7988_mac_port_get_caps(). Make .mac_port_config optional. Before calling priv->info->mac_port_config(), if there's no mac_port_config member in the priv->info table, exit mt753x_mac_config() successfully. Remove mac_port_config from the sanity check as the sanity check requires a pointer to a mac_port_config function to be non-NULL. This will fail for MT7988 as mac_port_config won't be a member of its info table. Signed-off-by: Arınç ÜNAL Co-authored-by: Daniel Golle Signed-off-by: Daniel Golle --- drivers/net/dsa/mt7530.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 903e39b7b772..dd2221e839d9 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2629,17 +2629,6 @@ static bool mt753x_is_mac_port(u32 port) return (port == 5 || port == 6); } -static int -mt7988_mac_config(struct dsa_switch *ds, int port, unsigned int mode, - phy_interface_t interface) -{ - if (dsa_is_cpu_port(ds, port) && - interface == PHY_INTERFACE_MODE_INTERNAL) - return 0; - - return -EINVAL; -} - static int mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) @@ -2680,6 +2669,9 @@ mt753x_mac_config(struct dsa_switch *ds, int port, unsigned int mode, { struct mt7530_priv *priv = ds->priv; + if (!priv->info->mac_port_config) + return 0; + return priv->info->mac_port_config(ds, port, mode, state->interface); } @@ -3123,7 +3115,6 @@ const struct mt753x_info mt753x_table[] = { .phy_write_c45 = mt7531_ind_c45_phy_write, .cpu_port_config = mt7988_cpu_port_config, .mac_port_get_caps = mt7988_mac_port_get_caps, - .mac_port_config = mt7988_mac_config, }, }; EXPORT_SYMBOL_GPL(mt753x_table); @@ -3151,8 +3142,7 @@ mt7530_probe_common(struct mt7530_priv *priv) * properly. */ if (!priv->info->sw_setup || !priv->info->phy_read_c22 || - !priv->info->phy_write_c22 || !priv->info->mac_port_get_caps || - !priv->info->mac_port_config) + !priv->info->phy_write_c22 || !priv->info->mac_port_get_caps) return -EINVAL; priv->id = priv->info->id; -- 2.37.2