net: mscc: ocelot: remove unnecessary variable
authorColin Foster <colin.foster@in-advantage.com>
Sat, 30 Apr 2022 23:23:26 +0000 (16:23 -0700)
committerJakub Kicinski <kuba@kernel.org>
Mon, 2 May 2022 21:04:17 +0000 (14:04 -0700)
Commit 2f187bfa6f35 ("net: ethernet: ocelot: remove the need for num_stats
initializer") added a flags field to the ocelot stats structure. The same
behavior can be achieved without this additional field taking up extra
memory.

Remove this structure element to free up RAM

Suggested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/soc/mscc/ocelot.h

index 5c4f57cfa7858bbd5bf7e33bb7d2720fc3f530a0..75739766244bb185d385b1c0a78e229b40b34b09 100644 (file)
 #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)->name[0] != '\0');                         \
             (stat)++)
 
 enum ocelot_target {
@@ -542,11 +540,10 @@ 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 }
+#define OCELOT_STAT_END { .name = "" }
 
 struct ocelot_stats_region {
        struct list_head node;