[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJq09z7mBRwCuXEjV1SBuDAPy70R5c07_8=LBVJPQZQczK=RoA@mail.gmail.com>
Date: Fri, 17 Dec 2021 03:50:41 -0300
From: Luiz Angelo Daros de Luca <luizluca@...il.com>
To: Alvin Šipraga <ALSI@...g-olufsen.dk>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linus.walleij@...aro.org" <linus.walleij@...aro.org>,
"andrew@...n.ch" <andrew@...n.ch>,
"vivien.didelot@...il.com" <vivien.didelot@...il.com>,
"f.fainelli@...il.com" <f.fainelli@...il.com>,
"olteanv@...il.com" <olteanv@...il.com>,
"arinc.unal@...nc9.com" <arinc.unal@...nc9.com>
Subject: Re: [PATCH net-next 04/13] net: dsa: realtek: convert subdrivers into modules
Em qui., 16 de dez. de 2021 às 20:29, Alvin Šipraga
<ALSI@...g-olufsen.dk> escreveu:
>
> On 12/16/21 21:13, luizluca@...il.com wrote:
> > From: Luiz Angelo Daros de Luca <luizluca@...il.com>
> >
> > Preparing for multiple interfaces support, the drivers
> > must be independent of realtek-smi.
> >
> > Tested-by: Arınç ÜNAL <arinc.unal@...nc9.com>
> > Signed-off-by: Luiz Angelo Daros de Luca <luizluca@...il.com>
> > ---
> > drivers/net/dsa/realtek/Kconfig | 20 +++++++++++++++++--
> > drivers/net/dsa/realtek/Makefile | 4 +++-
> > .../{realtek-smi-core.c => realtek-smi.c} | 15 ++++++++++----
> > drivers/net/dsa/realtek/rtl8365mb.c | 2 ++
> > .../dsa/realtek/{rtl8366.c => rtl8366-core.c} | 0
> > drivers/net/dsa/realtek/rtl8366rb.c | 2 ++
> > 6 files changed, 36 insertions(+), 7 deletions(-)
> > rename drivers/net/dsa/realtek/{realtek-smi-core.c => realtek-smi.c} (96%)
> > rename drivers/net/dsa/realtek/{rtl8366.c => rtl8366-core.c} (100%)
> >
> > diff --git a/drivers/net/dsa/realtek/Kconfig b/drivers/net/dsa/realtek/Kconfig
> > index bbc6e918baa6..c002a84a00f5 100644
> > --- a/drivers/net/dsa/realtek/Kconfig
> > +++ b/drivers/net/dsa/realtek/Kconfig
> > @@ -2,8 +2,6 @@
> > menuconfig NET_DSA_REALTEK
> > tristate "Realtek Ethernet switch family support"
> > depends on NET_DSA
> > - select NET_DSA_TAG_RTL4_A
> > - select NET_DSA_TAG_RTL8_4
> > select FIXED_PHY
> > select IRQ_DOMAIN
> > select REALTEK_PHY
> > @@ -17,3 +15,21 @@ config NET_DSA_REALTEK_SMI
> > default y
> > help
> > Select to enable support for registering switches connected through SMI.
> > +
> > +config NET_DSA_REALTEK_RTL8365MB
> > + tristate "Realtek RTL8365MB switch subdriver"
> > + default y
> > + depends on NET_DSA_REALTEK
> > + depends on NET_DSA_REALTEK_SMI
> > + select NET_DSA_TAG_RTL8_4
> > + help
> > + Select to enable support for Realtek RTL8365MB
> > +
> > +config NET_DSA_REALTEK_RTL8366RB
> > + tristate "Realtek RTL8366RB switch subdriver"
> > + default y
> > + depends on NET_DSA_REALTEK
> > + depends on NET_DSA_REALTEK_SMI
> > + select NET_DSA_TAG_RTL4_A
> > + help
> > + Select to enable support for Realtek RTL8366RB
> > diff --git a/drivers/net/dsa/realtek/Makefile b/drivers/net/dsa/realtek/Makefile
> > index 323b921bfce0..8b5a4abcedd3 100644
> > --- a/drivers/net/dsa/realtek/Makefile
> > +++ b/drivers/net/dsa/realtek/Makefile
> > @@ -1,3 +1,5 @@
> > # SPDX-License-Identifier: GPL-2.0
> > obj-$(CONFIG_NET_DSA_REALTEK_SMI) += realtek-smi.o
> > -realtek-smi-objs := realtek-smi-core.o rtl8366.o rtl8366rb.o rtl8365mb.o
> > +obj-$(CONFIG_NET_DSA_REALTEK_RTL8366RB) += rtl8366.o
>
> Maybe this should be CONFIG_NET_DSA_REALTEK_RTL8366 (no RB)? Not that I
> put my faith in Realtek's naming scheme...
>
Let's discuss this one in the rename patch. Unfortunately, I think
that there is no perfect name.
> > +rtl8366-objs := rtl8366-core.o rtl8366rb.o
> > +obj-$(CONFIG_NET_DSA_REALTEK_RTL8365MB) += rtl8365mb.o
> > diff --git a/drivers/net/dsa/realtek/realtek-smi-core.c b/drivers/net/dsa/realtek/realtek-smi.c
> > similarity index 96%
> > rename from drivers/net/dsa/realtek/realtek-smi-core.c
> > rename to drivers/net/dsa/realtek/realtek-smi.c
> > index 2c78eb5c0bdc..11447096c8dc 100644
> > --- a/drivers/net/dsa/realtek/realtek-smi-core.c
> > +++ b/drivers/net/dsa/realtek/realtek-smi.c
> > @@ -297,7 +297,6 @@ int realtek_smi_write_reg_noack(struct realtek_priv *priv, u32 addr,
> > {
> > return realtek_smi_write_reg(priv, addr, data, false);
> > }
> > -EXPORT_SYMBOL_GPL(realtek_smi_write_reg_noack);
> >
> > /* Regmap accessors */
> >
> > @@ -342,8 +341,9 @@ static int realtek_smi_mdio_write(struct mii_bus *bus, int addr, int regnum,
> > return priv->ops->phy_write(priv, addr, regnum, val);
> > }
> >
> > -int realtek_smi_setup_mdio(struct realtek_priv *priv)
> > +int realtek_smi_setup_mdio(struct dsa_switch *ds)
> > {
> > + struct realtek_priv *priv = (struct realtek_priv *)ds->priv;
> > struct device_node *mdio_np;
> > int ret;
> >
> > @@ -363,10 +363,10 @@ int realtek_smi_setup_mdio(struct realtek_priv *priv)
> > priv->slave_mii_bus->read = realtek_smi_mdio_read;
> > priv->slave_mii_bus->write = realtek_smi_mdio_write;
> > snprintf(priv->slave_mii_bus->id, MII_BUS_ID_SIZE, "SMI-%d",
> > - priv->ds->index);
> > + ds->index);
> > priv->slave_mii_bus->dev.of_node = mdio_np;
> > priv->slave_mii_bus->parent = priv->dev;
> > - priv->ds->slave_mii_bus = priv->slave_mii_bus;
> > + ds->slave_mii_bus = priv->slave_mii_bus;
> >
> > ret = devm_of_mdiobus_register(priv->dev, priv->slave_mii_bus, mdio_np);
> > if (ret) {
> > @@ -413,6 +413,9 @@ static int realtek_smi_probe(struct platform_device *pdev)
> > priv->cmd_write = var->cmd_write;
> > priv->ops = var->ops;
> >
> > + priv->setup_interface=realtek_smi_setup_mdio;
> > + priv->write_reg_noack=realtek_smi_write_reg_noack;
>
> Formatting: a = b, not a=b.
>
Check patch also got it. Thanks.
> > +
> > dev_set_drvdata(dev, priv);
> > spin_lock_init(&priv->lock);
> >
> > @@ -492,19 +495,23 @@ static void realtek_smi_shutdown(struct platform_device *pdev)
> > }
> >
> > static const struct of_device_id realtek_smi_of_match[] = {
> > +#if IS_ENABLED(CONFIG_NET_DSA_REALTEK_RTL8366RB)
> > {
> > .compatible = "realtek,rtl8366rb",
> > .data = &rtl8366rb_variant,
> > },
> > +#endif
> > {
> > /* FIXME: add support for RTL8366S and more */
> > .compatible = "realtek,rtl8366s",
> > .data = NULL,
> > },
> > +#if IS_ENABLED(CONFIG_NET_DSA_REALTEK_RTL8365MB)
> > {
> > .compatible = "realtek,rtl8365mb",
> > .data = &rtl8365mb_variant,
> > },
> > +#endif
> > { /* sentinel */ },
> > };
> > MODULE_DEVICE_TABLE(of, realtek_smi_of_match);
> > diff --git a/drivers/net/dsa/realtek/rtl8365mb.c b/drivers/net/dsa/realtek/rtl8365mb.c
> > index f562a6efb574..d6054f63f204 100644
> > --- a/drivers/net/dsa/realtek/rtl8365mb.c
> > +++ b/drivers/net/dsa/realtek/rtl8365mb.c
> > @@ -1987,3 +1987,5 @@ const struct realtek_variant rtl8365mb_variant = {
> > .chip_data_sz = sizeof(struct rtl8365mb),
> > };
> > EXPORT_SYMBOL_GPL(rtl8365mb_variant);
> > +
> > +MODULE_LICENSE("GPL");
>
> You could also add MODULE_DESCRIPTION/MODULE_AUTHORs to these subdrivers
> now that they are free from the core.
realtek-smi also didn't have them. I'll add as well from the author of
the first commit in git log.
It might not be fair with other authors. If anyone sees a problem, I
can add/remove names.
Also, I'm not sure if I should name the authors without their ok
>
> > diff --git a/drivers/net/dsa/realtek/rtl8366.c b/drivers/net/dsa/realtek/rtl8366-core.c
> > similarity index 100%
> > rename from drivers/net/dsa/realtek/rtl8366.c
> > rename to drivers/net/dsa/realtek/rtl8366-core.c
> > diff --git a/drivers/net/dsa/realtek/rtl8366rb.c b/drivers/net/dsa/realtek/rtl8366rb.c
> > index b1635c20276b..31f1a949c8e7 100644
> > --- a/drivers/net/dsa/realtek/rtl8366rb.c
> > +++ b/drivers/net/dsa/realtek/rtl8366rb.c
> > @@ -1812,3 +1812,5 @@ const struct realtek_variant rtl8366rb_variant = {
> > .chip_data_sz = sizeof(struct rtl8366rb),
> > };
> > EXPORT_SYMBOL_GPL(rtl8366rb_variant);
> > +
> > +MODULE_LICENSE("GPL");
>
Powered by blists - more mailing lists