[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220509105638.btfgdr4wt427ewip@skbuf>
Date: Mon, 9 May 2022 10:56:39 +0000
From: Vladimir Oltean <vladimir.oltean@....com>
To: Colin Foster <colin.foster@...advantage.com>
CC: "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Terry Bowman <terry.bowman@....com>,
Wolfram Sang <wsa@...nel.org>,
Andy Shevchenko <andy.shevchenko@...il.com>,
Steen Hegelund <Steen.Hegelund@...rochip.com>,
Lars Povlsen <lars.povlsen@...rochip.com>,
Linus Walleij <linus.walleij@...aro.org>,
Russell King <linux@...linux.org.uk>,
Heiner Kallweit <hkallweit1@...il.com>,
Paolo Abeni <pabeni@...hat.com>,
Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
"David S. Miller" <davem@...emloft.net>,
Florian Fainelli <f.fainelli@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>,
Andrew Lunn <andrew@...n.ch>,
"UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Claudiu Manoil <claudiu.manoil@....com>,
Lee Jones <lee.jones@...aro.org>
Subject: Re: [RFC v8 net-next 11/16] net: mscc: ocelot: expose regfield
definition to be used by other drivers
On Sun, May 08, 2022 at 11:53:08AM -0700, Colin Foster wrote:
> The ocelot_regfields struct is common between several different chips, some
> of which can only be controlled externally. Export this structure so it
> doesn't have to be duplicated in these other drivers.
>
> Rename the structure as well, to follow the conventions of other shared
> resources.
>
> Signed-off-by: Colin Foster <colin.foster@...advantage.com>
> ---
Doesn't the symbol need to be actually _exported_ (EXPORT_SYMBOL) to
work when CONFIG_MSCC_OCELOT_SWITCH_LIB is a module?
> drivers/net/ethernet/mscc/ocelot_vsc7514.c | 60 +---------------------
> drivers/net/ethernet/mscc/vsc7514_regs.c | 59 +++++++++++++++++++++
> include/soc/mscc/vsc7514_regs.h | 2 +
> 3 files changed, 62 insertions(+), 59 deletions(-)
>
> diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c
> index 68d205088665..a13fec7247d6 100644
> --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c
> +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c
> @@ -38,64 +38,6 @@ static const u32 *ocelot_regmap[TARGET_MAX] = {
> [DEV_GMII] = vsc7514_dev_gmii_regmap,
> };
>
> -static const struct reg_field ocelot_regfields[REGFIELD_MAX] = {
> -};
> -
> static const struct ocelot_stat_layout ocelot_stats_layout[] = {
> { .name = "rx_octets", .offset = 0x00, },
> { .name = "rx_unicast", .offset = 0x01, },
> @@ -231,7 +173,7 @@ static int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops)
> ocelot->num_mact_rows = 1024;
> ocelot->ops = ops;
>
> - ret = ocelot_regfields_init(ocelot, ocelot_regfields);
> + ret = ocelot_regfields_init(ocelot, vsc7514_regfields);
> if (ret)
> return ret;
>
> diff --git a/drivers/net/ethernet/mscc/vsc7514_regs.c b/drivers/net/ethernet/mscc/vsc7514_regs.c
> index c2af4eb8ca5d..847e64d11075 100644
> --- a/drivers/net/ethernet/mscc/vsc7514_regs.c
> +++ b/drivers/net/ethernet/mscc/vsc7514_regs.c
> @@ -9,6 +9,65 @@
> #include <soc/mscc/vsc7514_regs.h>
> #include "ocelot.h"
>
> +const struct reg_field vsc7514_regfields[REGFIELD_MAX] = {
> +};
> +
> const u32 vsc7514_ana_regmap[] = {
> REG(ANA_ADVLEARN, 0x009000),
> REG(ANA_VLANMASK, 0x009004),
> diff --git a/include/soc/mscc/vsc7514_regs.h b/include/soc/mscc/vsc7514_regs.h
> index ceee26c96959..9b40e7d00ec5 100644
> --- a/include/soc/mscc/vsc7514_regs.h
> +++ b/include/soc/mscc/vsc7514_regs.h
> @@ -10,6 +10,8 @@
>
> #include <soc/mscc/ocelot_vcap.h>
>
> +extern const struct reg_field vsc7514_regfields[REGFIELD_MAX];
> +
> extern const u32 vsc7514_ana_regmap[];
> extern const u32 vsc7514_qs_regmap[];
> extern const u32 vsc7514_qsys_regmap[];
> --
> 2.25.1
>
Powered by blists - more mailing lists