diff options
author | Colin Foster <colin.foster@in-advantage.com> | 2022-04-29 23:30:36 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-04-30 14:38:49 +0200 |
commit | 2f187bfa6f35cc8bf1626bfc09449a09a6063ea1 (patch) | |
tree | 1191c1b8805b5b2a48a24b12f3434627247710a3 /include/soc | |
parent | tcp: drop skb dst in tcp_rcv_established() (diff) | |
download | linux-2f187bfa6f35cc8bf1626bfc09449a09a6063ea1.tar.xz linux-2f187bfa6f35cc8bf1626bfc09449a09a6063ea1.zip |
net: ethernet: ocelot: remove the need for num_stats initializer
There is a desire to share the oclot_stats_layout struct outside of the
current vsc7514 driver. In order to do so, the length of the array needs to
be known at compile time, and defined in the struct ocelot and struct
felix_info.
Since the array is defined in a .c file and would be declared in the header
file via:
extern struct ocelot_stat_layout[];
the size of the array will not be known at compile time to outside modules.
To fix this, remove the need for defining the number of stats at compile
time and allow this number to be determined at initialization.
Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/soc')
-rw-r--r-- | include/soc/mscc/ocelot.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 9b4e6c78d0f4..5c4f57cfa785 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -105,6 +105,13 @@ #define REG_RESERVED_ADDR 0xffffffff #define REG_RESERVED(reg) REG(reg, REG_RESERVED_ADDR) +#define OCELOT_STAT_FLAG_END BIT(0) + +#define for_each_stat(ocelot, stat) \ + for ((stat) = ocelot->stats_layout; \ + !((stat)->flags & OCELOT_STAT_FLAG_END); \ + (stat)++) + enum ocelot_target { ANA = 1, QS, @@ -535,9 +542,12 @@ enum ocelot_ptp_pins { struct ocelot_stat_layout { u32 offset; + u32 flags; char name[ETH_GSTRING_LEN]; }; +#define OCELOT_STAT_END { .flags = OCELOT_STAT_FLAG_END } + struct ocelot_stats_region { struct list_head node; u32 offset; |