[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220706102621.hfubvn3wa6wlw735@skbuf>
Date: Wed, 6 Jul 2022 13:26:21 +0300
From: Vladimir Oltean <olteanv@...il.com>
To: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
Cc: Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Alvin __ipraga <alsi@...g-olufsen.dk>,
Claudiu Manoil <claudiu.manoil@....com>,
"David S. Miller" <davem@...emloft.net>,
DENG Qingfang <dqfext@...il.com>,
Eric Dumazet <edumazet@...gle.com>,
Florian Fainelli <f.fainelli@...il.com>,
George McCollister <george.mccollister@...il.com>,
Hauke Mehrtens <hauke@...ke-m.de>,
Jakub Kicinski <kuba@...nel.org>,
Kurt Kanzenbach <kurt@...utronix.de>,
Landen Chao <Landen.Chao@...iatek.com>,
Linus Walleij <linus.walleij@...aro.org>,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
Matthias Brugger <matthias.bgg@...il.com>,
netdev@...r.kernel.org, Paolo Abeni <pabeni@...hat.com>,
Sean Wang <sean.wang@...iatek.com>,
UNGLinuxDriver@...rochip.com,
Vivien Didelot <vivien.didelot@...il.com>,
Woojung Huh <woojung.huh@...rochip.com>,
Marek BehĂșn <kabel@...nel.org>
Subject: Re: [PATCH RFC net-next 5/5] net: dsa: always use phylink for CPU
and DSA ports
Hello,
On Tue, Jul 05, 2022 at 10:48:07AM +0100, Russell King (Oracle) wrote:
> diff --git a/net/dsa/port.c b/net/dsa/port.c
> index 35b4e1f8dc05..34487e62eb03 100644
> --- a/net/dsa/port.c
> +++ b/net/dsa/port.c
> @@ -1525,6 +1525,7 @@ int dsa_port_phylink_create(struct dsa_port *dp)
> {
> struct dsa_switch *ds = dp->ds;
> phy_interface_t mode, def_mode;
> + struct device_node *phy_np;
> int err;
>
> /* Presence of phylink_mac_link_state or phylink_mac_an_restart is
> @@ -1559,6 +1560,13 @@ int dsa_port_phylink_create(struct dsa_port *dp)
> return PTR_ERR(dp->pl);
> }
>
> + if (dp->type == DSA_PORT_TYPE_CPU || dp->type == DSA_PORT_TYPE_DSA) {
> + phy_np = of_parse_phandle(dp->dn, "phy-handle", 0);
> + of_node_put(phy_np);
> + if (!phy_np)
> + err = phylink_set_max_fixed_link(dp->pl);
Can we please limit phylink_set_max_link_speed() to just the CPU ports
where a fixed-link property is also missing, not just a phy-handle?
Although to be entirely correct, we can also have MLO_AN_INBAND, which
wouldn't be covered by these 2 checks and would still represent a valid
DT binding.
> + }
> +
> return 0;
> }
>
> @@ -1663,20 +1671,14 @@ static int dsa_port_phylink_register(struct dsa_port *dp)
> int dsa_port_link_register_of(struct dsa_port *dp)
> {
> struct dsa_switch *ds = dp->ds;
> - struct device_node *phy_np;
> int port = dp->index;
>
> if (!ds->ops->adjust_link) {
> - phy_np = of_parse_phandle(dp->dn, "phy-handle", 0);
> - if (of_phy_is_fixed_link(dp->dn) || phy_np) {
> - if (ds->ops->phylink_mac_link_down)
> - ds->ops->phylink_mac_link_down(ds, port,
> - MLO_AN_FIXED, PHY_INTERFACE_MODE_NA);
> - of_node_put(phy_np);
> - return dsa_port_phylink_register(dp);
> - }
> - of_node_put(phy_np);
> - return 0;
> + if (ds->ops->phylink_mac_link_down)
> + ds->ops->phylink_mac_link_down(ds, port,
> + MLO_AN_FIXED, PHY_INTERFACE_MODE_NA);
Can you please align these arguments to the open bracket?
> +
> + return dsa_port_phylink_register(dp);
> }
>
> dev_warn(ds->dev,
> --
> 2.30.2
>
Powered by blists - more mailing lists