Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1850897rdb; Thu, 7 Dec 2023 10:19:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IH0n6IfPM8yvhLzV9AoeIiXoSpsNtrCzWv04IQsckRsXpRPyI8fmYFq2I/pYBNgcheyyBVS X-Received: by 2002:a05:6a00:1bc8:b0:6ce:4059:2300 with SMTP id o8-20020a056a001bc800b006ce40592300mr2243551pfw.27.1701973153260; Thu, 07 Dec 2023 10:19:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701973153; cv=none; d=google.com; s=arc-20160816; b=uSQ8X77XaiuqD8rtry+xGfneb5uRGjzCns+0nOa3GTkXQIJEJBwzu11c202gwV/w2Q /O0i3B5gRu7dT8Jv1999b2Tmjiea7WTZ07/Uf7kFtdUccz7+mItgCJDZ4YK7kHFQJxLH UMkwxiOBg+PevxloosePU22CwM4aklveEWbV3r95W+EGPK7x6xIdKR4k7BreI9N6FJGs CxhqIVwltyPFfwRoaQ1XeOb01RAZpxrP2SC+102a51JEGCSmFr04klRlKcN+fJvL0Eq0 29bqCVkPxwrwYZ02laCaAUHXFysACwBoC1bJqj+BNzGlWAE+zUZS84n+3oC0D42qniQB CTwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=c9T9Dhk1u4UBA5bWyuf5C2EepRsZ1GhJrZKYEms2QYA=; fh=2JZ+UG1AogFwOcDhtSf278wL4E3lSlZ+nT3qMgBPsh0=; b=ix908CD1xDUwP+dWluWQNrVWLvLvQsy3e65Q4v6/qorJzCbkj224doxicXIGoldrUm jUIfaKpUfa4+jmvcGAHk1QP+6t4U+A/wcbfjm0eytzA8aMvD7H3VzRxWIUZrPxvwVyG0 kLdhs6irWz8ndn1fb6Q8uNS1kKddiztXamfv8qcffMuUiCSCUrpLctuR6HWBNbrxNzV9 J4b3gJoE6qzlGS1WCGrfGYSZreh8PpZMUaK3NmbyDTc2DsvDdVOIf4azYTnUUhZYif+S 6NNvhIZqVLalPQW/MgtWAIuOSLpWsQI+zhL3iLtBLNznGBObLvowBPF9wpa865WnVVW/ oP2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VVwUTEM+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id 36-20020a631564000000b005c625af78acsi77833pgv.881.2023.12.07.10.19.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 10:19:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VVwUTEM+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B8BC480D15A3; Thu, 7 Dec 2023 10:19:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443634AbjLGSS6 (ORCPT + 99 others); Thu, 7 Dec 2023 13:18:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231719AbjLGSS5 (ORCPT ); Thu, 7 Dec 2023 13:18:57 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7C3A10E3; Thu, 7 Dec 2023 10:19:03 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a1f37fd4b53so95049066b.1; Thu, 07 Dec 2023 10:19:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701973142; x=1702577942; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=c9T9Dhk1u4UBA5bWyuf5C2EepRsZ1GhJrZKYEms2QYA=; b=VVwUTEM+XrKFHBEr6R/eD/Fv3vfBWLsM2f4uUxeZpomwdswdHUBcfw8xNU0/esTB+D 1q+hK4oKS1BlaWzGt1PpEQUKq4o/tpBnONt6e+MKL4dfkh7uO7xNkRveg6CeQcyxUX+p SU1inDIRi640pIPD85ibmqQZ6le1HFmmAEUZKNv67IW7ByHfOogOCeVYlnnL+fiDvScZ sN/GvTmA9yeY3ESsAHf0Zcrdrt0hPwegqPvAR9NS8wFoezSAURDMX5Fsk0P8BTSCPwfk eicNofLSnis2TuobYrrPh+ZintPdcI4ig3Teld2GKL8uIB7e359KZwijpbZl1iBDOnC/ cSpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701973142; x=1702577942; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=c9T9Dhk1u4UBA5bWyuf5C2EepRsZ1GhJrZKYEms2QYA=; b=HXDQdLaO+7WIECCCShS/wLnqbOjNvg+IY1EzMQsJg/ShUiwyk2+nuzC/G8TaerEWqu U7KLoONsT5STde03vJXt6ULLWsplCjOX83qIluG2urvaiiKhX2VX/WOnTsAXRiJSHvC9 3UsCFHYWM7GZx5MoB1Sfnk1cg7aSQGBfyQrHMpfcVt/C3EohptzVG+WkWaFDlNru3zls QkkAUYD11oOR26c1+AVGh71y3kX4JXwWagsCiBmUrPyjojPVyo7FuvoX3fb6xXmV8pG8 /+rKFvsTfI6hgmZddt5QCpMcQx4JD+dV8mabcEHR1UIZIuFTisu0XHZ3LcqZg/WSJQZ5 L+wA== X-Gm-Message-State: AOJu0Yx/EI70ofgjWKar0ZqSSW4dW40yyTmKnUR4EQBi2PnHM/o7KQJe zUtVaz9l6Uia4kawGxDl9nU= X-Received: by 2002:a17:906:43:b0:a19:39d1:f958 with SMTP id 3-20020a170906004300b00a1939d1f958mr1762530ejg.41.1701973141888; Thu, 07 Dec 2023 10:19:01 -0800 (PST) Received: from skbuf ([188.27.185.68]) by smtp.gmail.com with ESMTPSA id ll9-20020a170907190900b00a1cbb289a7csm45995ejc.183.2023.12.07.10.19.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 10:19:01 -0800 (PST) Date: Thu, 7 Dec 2023 20:18:58 +0200 From: Vladimir Oltean To: =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= Cc: Daniel Golle , Landen Chao , DENG Qingfang , Sean Wang , Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Frank Wunderlich , Bartel Eerdekens , mithat.guner@xeront.com, erkin.bozoglu@xeront.com Subject: Re: [PATCH net-next 06/15] net: dsa: mt7530: do not set priv->p5_interface on mt7530_setup_port5() Message-ID: <20231207181858.ojbgt5pwyqq3tzjk@skbuf> References: <20231118123205.266819-1-arinc.unal@arinc9.com> <20231118123205.266819-7-arinc.unal@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231118123205.266819-7-arinc.unal@arinc9.com> X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 07 Dec 2023 10:19:10 -0800 (PST) On Sat, Nov 18, 2023 at 03:31:56PM +0300, Arınç ÜNAL wrote: > Do not set priv->p5_interface on mt7530_setup_port5(). There isn't a case > where mt753x_phylink_mac_config() runs after mt7530_setup_port5() which > setting priv->p5_interface would prevent mt7530_setup_port5() from running > more than once. > > Signed-off-by: Arınç ÜNAL > --- > drivers/net/dsa/mt7530.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c > index 069b3dfca6fa..fc87ec817672 100644 > --- a/drivers/net/dsa/mt7530.c > +++ b/drivers/net/dsa/mt7530.c > @@ -978,8 +978,6 @@ static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface) > dev_dbg(ds->dev, "Setup P5, HWTRAP=0x%x, intf_sel=%s, phy-mode=%s\n", > val, p5_intf_modes(priv->p5_intf_sel), phy_modes(interface)); > > - priv->p5_interface = interface; > - > unlock_exit: > mutex_unlock(&priv->reg_mutex); > } > -- > 2.40.1 > Purely as a matter of theory, mt753x_phylink_mac_config() itself could be called more than once, at any time there is a phylink_major_config() - first during initial one, then upon any change of the phy_interface_t. With the port being fixed and internal, maybe that is unlikely. Destroying and re-creating the phylink instance could also make the driver see more than 1 mt753x_phylink_mac_config() call. During periods of -EPROBE_DEFER, maybe this could even happen. I think what we need to see is a description of what the priv->p5_interface test is really protecting against, because it certainly is uncommon in other drivers to have this much logic to avoid mt753x_mac_config() being called twice. If there's nothing wrong with calling it twice and it's just an optimization, I think that's enough of a justification for removing that extra protection. At the same time, the optimization (and simplification) that we should pursue is that we should remove the overlap between phylink and the initial port setup made by the driver.