From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Vivien Didelot <vivien.didelot@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
George McCollister <george.mccollister@gmail.com>,
Hauke Mehrtens <hauke@hauke-m.de>,
Kurt Kanzenbach <kurt@linutronix.de>,
Woojung Huh <woojung.huh@microchip.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>
Subject: Re: [PATCH RFC net-next 01/12] net: dsa: consolidate phylink creation
Date: Wed, 24 Nov 2021 23:25:17 +0000 [thread overview]
Message-ID: <YZ7J3fGZmGMX8lYg@shell.armlinux.org.uk> (raw)
In-Reply-To: <20211124181156.5g3z2inlaai5lcvd@skbuf>
On Wed, Nov 24, 2021 at 06:11:57PM +0000, Vladimir Oltean wrote:
> On Wed, Nov 24, 2021 at 05:52:28PM +0000, Russell King (Oracle) wrote:
> > The code in port.c and slave.c creating the phylink instance is very
> > similar - let's consolidate this into a single function.
> >
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > ---
> > net/dsa/dsa_priv.h | 2 +-
> > net/dsa/port.c | 44 ++++++++++++++++++++++++++++----------------
> > net/dsa/slave.c | 19 +++----------------
> > 3 files changed, 32 insertions(+), 33 deletions(-)
> >
> > diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
> > index a5c9bc7b66c6..3fb2c37c9b88 100644
> > --- a/net/dsa/dsa_priv.h
> > +++ b/net/dsa/dsa_priv.h
> > @@ -258,13 +258,13 @@ int dsa_port_mrp_add_ring_role(const struct dsa_port *dp,
> > const struct switchdev_obj_ring_role_mrp *mrp);
> > int dsa_port_mrp_del_ring_role(const struct dsa_port *dp,
> > const struct switchdev_obj_ring_role_mrp *mrp);
> > +int dsa_port_phylink_create(struct dsa_port *dp);
> > int dsa_port_link_register_of(struct dsa_port *dp);
> > void dsa_port_link_unregister_of(struct dsa_port *dp);
> > int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr);
> > void dsa_port_hsr_leave(struct dsa_port *dp, struct net_device *hsr);
> > int dsa_port_tag_8021q_vlan_add(struct dsa_port *dp, u16 vid, bool broadcast);
> > void dsa_port_tag_8021q_vlan_del(struct dsa_port *dp, u16 vid, bool broadcast);
> > -extern const struct phylink_mac_ops dsa_port_phylink_mac_ops;
> >
> > static inline bool dsa_port_offloads_bridge_port(struct dsa_port *dp,
> > const struct net_device *dev)
> > diff --git a/net/dsa/port.c b/net/dsa/port.c
> > index f6f12ad2b525..eaa66114924b 100644
> > --- a/net/dsa/port.c
> > +++ b/net/dsa/port.c
> > @@ -1072,7 +1072,7 @@ static void dsa_port_phylink_mac_link_up(struct phylink_config *config,
> > speed, duplex, tx_pause, rx_pause);
> > }
> >
> > -const struct phylink_mac_ops dsa_port_phylink_mac_ops = {
> > +static const struct phylink_mac_ops dsa_port_phylink_mac_ops = {
> > .validate = dsa_port_phylink_validate,
> > .mac_pcs_get_state = dsa_port_phylink_mac_pcs_get_state,
> > .mac_config = dsa_port_phylink_mac_config,
> > @@ -1081,6 +1081,30 @@ const struct phylink_mac_ops dsa_port_phylink_mac_ops = {
> > .mac_link_up = dsa_port_phylink_mac_link_up,
> > };
> >
> > +int dsa_port_phylink_create(struct dsa_port *dp)
> > +{
> > + struct dsa_switch *ds = dp->ds;
> > + phy_interface_t mode;
> > + int err;
> > +
> > + err = of_get_phy_mode(dp->dn, &mode);
> > + if (err)
> > + mode = PHY_INTERFACE_MODE_NA;
> > +
> > + if (ds->ops->phylink_get_interfaces)
> > + ds->ops->phylink_get_interfaces(ds, dp->index,
> > + dp->pl_config.supported_interfaces);
>
> Can you please save dp->pl_config to a struct phylink_config *config
> temporary variable, and pass that here and to phylink_create() while
> preserving the alignment of that argument to the open brace? Thanks.
There is no point; first, this is how the original code was formatted
that is moved here, and second, this code is deleted in patch 3.
Making it a local variable, and then deleting it in patch 3 is pointless
churn.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2021-11-24 23:25 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 17:46 [PATCH RFC net-next 00/12] Allow DSA drivers to set all phylink capabilities Russell King (Oracle)
2021-11-24 17:52 ` [PATCH RFC net-next 01/12] net: dsa: consolidate phylink creation Russell King (Oracle)
2021-11-24 18:11 ` Vladimir Oltean
2021-11-24 23:25 ` Russell King (Oracle) [this message]
2021-11-24 17:52 ` [PATCH RFC net-next 02/12] net: dsa: support use of phylink_generic_validate() Russell King (Oracle)
2021-11-24 18:13 ` Vladimir Oltean
2021-11-24 17:52 ` [PATCH RFC net-next 03/12] net: dsa: replace phylink_get_interfaces() with phylink_get_caps() Russell King (Oracle)
2021-11-24 18:15 ` Vladimir Oltean
2021-11-24 18:26 ` Russell King (Oracle)
2021-11-24 19:10 ` Russell King (Oracle)
2021-11-24 20:26 ` Vladimir Oltean
2021-11-24 20:56 ` Russell King (Oracle)
2021-11-24 21:18 ` Vladimir Oltean
2021-11-24 17:52 ` [PATCH RFC net-next 04/12] net: dsa: ar9331: convert to phylink_generic_validate() Russell King (Oracle)
2021-11-24 17:52 ` [PATCH RFC net-next 05/12] net: dsa: bcm_sf2: " Russell King (Oracle)
2021-12-03 20:03 ` Florian Fainelli
2021-12-04 4:18 ` Florian Fainelli
2021-12-04 8:59 ` Russell King (Oracle)
2021-12-04 14:42 ` Russell King (Oracle)
2021-12-04 14:52 ` Russell King (Oracle)
2021-12-04 15:01 ` Andrew Lunn
2021-12-05 12:58 ` Russell King (Oracle)
2021-12-06 15:59 ` Tom Lendacky
2021-12-06 16:13 ` Russell King (Oracle)
2021-12-06 16:36 ` Tom Lendacky
2021-12-06 16:39 ` Russell King (Oracle)
2021-12-06 17:06 ` Florian Fainelli
2021-12-06 19:26 ` Russell King (Oracle)
2021-12-07 18:08 ` Russell King (Oracle)
2021-11-24 17:52 ` [PATCH RFC net-next 06/12] net: dsa: hellcreek: " Russell King (Oracle)
2021-11-25 8:49 ` Kurt Kanzenbach
2021-11-24 17:52 ` [PATCH RFC net-next 07/12] net: dsa: ksz8795: " Russell King (Oracle)
2021-11-24 17:53 ` [PATCH RFC net-next 08/12] net: dsa: lantiq: " Russell King (Oracle)
2021-11-28 18:49 ` Hauke Mehrtens
2021-11-24 17:53 ` [PATCH RFC net-next 09/12] net: dsa: ocelot: " Russell King (Oracle)
2021-11-24 20:07 ` Vladimir Oltean
2021-11-24 21:21 ` Russell King (Oracle)
2021-11-24 17:53 ` [PATCH RFC net-next 10/12] net: dsa: qca8k: " Russell King (Oracle)
2021-11-24 17:53 ` [PATCH RFC net-next 11/12] net: dsa: sja1105: " Russell King (Oracle)
2021-11-24 19:53 ` Vladimir Oltean
2021-11-24 21:08 ` Russell King (Oracle)
2021-11-24 22:34 ` Vladimir Oltean
2021-11-24 23:21 ` Russell King (Oracle)
2021-11-24 23:32 ` Vladimir Oltean
2021-11-25 12:56 ` Russell King (Oracle)
2021-11-25 16:18 ` Vladimir Oltean
2021-11-24 17:53 ` [PATCH RFC net-next 12/12] net: dsa: xrs700x: " Russell King (Oracle)
2021-12-03 16:15 ` [PATCH RFC net-next 00/12] Allow DSA drivers to set all phylink capabilities Russell King (Oracle)
2021-12-03 19:28 ` Florian Fainelli
2021-12-03 19:44 ` Florian Fainelli
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=YZ7J3fGZmGMX8lYg@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=george.mccollister@gmail.com \
--cc=hauke@hauke-m.de \
--cc=kuba@kernel.org \
--cc=kurt@linutronix.de \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.com \
--cc=woojung.huh@microchip.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;
as well as URLs for NNTP newsgroup(s).