From: Vladimir Oltean <olteanv@gmail.com>
To: arinc9.unal@gmail.com
Cc: "Sean Wang" <sean.wang@mediatek.com>,
"Landen Chao" <Landen.Chao@mediatek.com>,
"DENG Qingfang" <dqfext@gmail.com>,
"Andrew Lunn" <andrew@lunn.ch>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Russell King" <linux@armlinux.org.uk>,
"René van Dorst" <opensource@vdorst.com>,
"Arınç ÜNAL" <arinc.unal@arinc9.com>,
"Russell King" <rmk+kernel@armlinux.org.uk>,
"Ilya Lipnitskiy" <ilya.lipnitskiy@gmail.com>,
"Richard van Schagen" <richard@routerhints.com>,
"Richard van Schagen" <vschagen@cs.com>,
"Frank Wunderlich" <frank-w@public-files.de>,
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: Re: [PATCH net 4/7] net: dsa: mt7530: set both CPU port interfaces to PHY_INTERFACE_MODE_NA
Date: Mon, 27 Mar 2023 22:12:42 +0300 [thread overview]
Message-ID: <20230327191242.4qabzrn3vtx3l2a7@skbuf> (raw)
In-Reply-To: <20230326140818.246575-5-arinc.unal@arinc9.com>
On Sun, Mar 26, 2023 at 05:08:15PM +0300, arinc9.unal@gmail.com wrote:
> From: Arınç ÜNAL <arinc.unal@arinc9.com>
>
> Set interfaces of both CPU ports to PHY_INTERFACE_MODE_NA. Either phylink
> or mt7530_setup_port5() on mt7530_setup() will handle the rest.
>
> This is already being done for port 6, do it for port 5 as well.
>
> Fixes: 38f790a80560 ("net: dsa: mt7530: Add support for port 5")
This is getting comical.. I think I'm putting too much energy in
trying to understand the hidden meaning of this patch set.
In include/linux/phy.h we have:
typedef enum {
PHY_INTERFACE_MODE_NA,
In lack of other initializer, 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, or PHY_INTERFACE_MODE_NA.
There is no code path between the devm_kzalloc() and the position in
mt7530_setup() that would change the value of priv->p5_interface or
priv->p6_interface from their value of 0 (PHY_INTERFACE_MODE_NA).
For example, mt753x_phylink_mac_config() can only be called from
phylink, after dsa_port_phylink_create() was called. But
dsa_port_phylink_create() comes later than ds->ops->setup() - one comes
from dsa_tree_setup_ports(), and the other from dsa_tree_setup_switches().
The movement of the priv->p6_interface assignment with a few lines
earlier does not change anything relative to the other call sites which
assign different values to priv->p6_interface, so there isn't any
functional change there, either.
So this patch is putting 0 into a variable containing 0, and claiming,
through the presence of the Fixes: tag and the submission to the "net"
tree, that it is a bug fix which should be backported to "stable".
Can it be that you are abusing the meaning of a "bug fix", and that I'm
trying too hard to take this patch set seriously?
> Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
> drivers/net/dsa/mt7530.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index 6d33c1050458..3deebdcfeedf 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -2203,14 +2203,18 @@ mt7530_setup(struct dsa_switch *ds)
> mt7530_rmw(priv, MT7530_TRGMII_RD(i),
> RD_TAP_MASK, RD_TAP(16));
>
> + /* Let phylink decide the interface later. If port 5 is used for phy
> + * muxing, its interface will be handled without involving phylink.
> + */
> + priv->p5_interface = PHY_INTERFACE_MODE_NA;
> + priv->p6_interface = PHY_INTERFACE_MODE_NA;
> +
> /* Enable port 6 */
> val = mt7530_read(priv, MT7530_MHWTRAP);
> val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS;
> 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);
>
> --
> 2.37.2
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-03-27 19:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-26 14:08 [PATCH 0/7] net: dsa: mt7530: fix port 5 phylink, phy muxing, and port 6 arinc9.unal
2023-03-26 14:08 ` [PATCH net 1/7] net: dsa: mt7530: fix comments regarding port 5 and 6 for both switches arinc9.unal
2023-03-26 14:08 ` [PATCH net 2/7] net: dsa: mt7530: fix phylink for port 5 and fix port 5 modes arinc9.unal
2023-03-27 18:49 ` Vladimir Oltean
2023-03-27 21:44 ` Arınç ÜNAL
2023-03-26 14:08 ` [PATCH net 3/7] net: dsa: mt7530: do not run mt7530_setup_port5() if port 5 is disabled arinc9.unal
2023-03-27 18:56 ` Vladimir Oltean
2023-03-27 21:46 ` Arınç ÜNAL
2023-03-26 14:08 ` [PATCH net 4/7] net: dsa: mt7530: set both CPU port interfaces to PHY_INTERFACE_MODE_NA arinc9.unal
2023-03-27 19:12 ` Vladimir Oltean [this message]
2023-03-27 21:57 ` Arınç ÜNAL
2023-03-28 2:03 ` Jakub Kicinski
2023-03-28 11:20 ` Vladimir Oltean
2023-03-28 21:26 ` Arınç ÜNAL
2023-03-26 14:08 ` [PATCH net 5/7] net: dsa: mt7530: set up port 5 before CPU ports are enabled arinc9.unal
2023-03-26 14:08 ` [PATCH net 6/7] net: dsa: mt7530: call port 6 setup from mt7530_mac_config() arinc9.unal
2023-03-26 14:08 ` [PATCH net 7/7] net: dsa: mt7530: remove pad_setup function pointer arinc9.unal
2023-03-28 11:21 ` [PATCH 0/7] net: dsa: mt7530: fix port 5 phylink, phy muxing, and port 6 Vladimir Oltean
2023-03-28 21:27 ` Arınç ÜNAL
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230327191242.4qabzrn3vtx3l2a7@skbuf \
--to=olteanv@gmail.com \
--cc=Landen.Chao@mediatek.com \
--cc=andrew@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=arinc.unal@arinc9.com \
--cc=arinc9.unal@gmail.com \
--cc=davem@davemloft.net \
--cc=dqfext@gmail.com \
--cc=edumazet@google.com \
--cc=erkin.bozoglu@xeront.com \
--cc=f.fainelli@gmail.com \
--cc=frank-w@public-files.de \
--cc=ilya.lipnitskiy@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=opensource@vdorst.com \
--cc=pabeni@redhat.com \
--cc=richard@routerhints.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=sean.wang@mediatek.com \
--cc=vschagen@cs.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox