[PATCH net 4/7] net: dsa: mt7530: set both CPU port interfaces to PHY_INTERFACE_MODE_NA
Arınç ÜNAL
arinc.unal at arinc9.com
Mon Mar 27 14:57:57 PDT 2023
On 27.03.2023 22:12, Vladimir Oltean wrote:
> On Sun, Mar 26, 2023 at 05:08:15PM +0300, arinc9.unal at gmail.com wrote:
>> From: Arınç ÜNAL <arinc.unal at 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?
I don't appreciate your consistent use of the word "abuse" on my
patches. I'm by no means a senior C programmer. I'm doing my best to
correct the driver.
Thank you for explaining the process of phylink with DSA, I will adjust
my patches accordingly.
I suggest you don't take my patches seriously for a while, until I know
better.
Arınç
More information about the linux-arm-kernel
mailing list