[PATCH 35/44] net: dsa: export dsa_switch_list
Ahmad Fatoum
a.fatoum at barebox.org
Mon Aug 11 05:28:15 PDT 2025
This list will be used by the upcoming bfetch command to
determine whether the running barebox has any DSA drivers bound.
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
drivers/net/dsa.c | 4 ++++
include/dsa.h | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/drivers/net/dsa.c b/drivers/net/dsa.c
index 537e9dd72ac6..667297e8fea3 100644
--- a/drivers/net/dsa.c
+++ b/drivers/net/dsa.c
@@ -6,6 +6,8 @@
#include <of_net.h>
#include <param.h>
+LIST_HEAD(dsa_switch_list);
+
u32 dsa_user_ports(struct dsa_switch *ds)
{
u32 mask = 0;
@@ -472,6 +474,8 @@ int dsa_register_switch(struct dsa_switch *ds)
ds->tx_buf = dma_alloc(DSA_PKTSIZE);
+ list_add_tail(&ds->list, &dsa_switch_list);
+
return 0;
}
EXPORT_SYMBOL_GPL(dsa_register_switch);
diff --git a/include/dsa.h b/include/dsa.h
index ecf7c4f429f3..b106d5474f7b 100644
--- a/include/dsa.h
+++ b/include/dsa.h
@@ -7,6 +7,7 @@
#define __DSA_H__
#include <linux/phy.h>
+#include <linux/list.h>
#include <net.h>
/**
@@ -88,6 +89,7 @@ struct dsa_switch {
u32 phys_mii_mask;
void *priv;
u32 forwarding_enable;
+ struct list_head list;
};
static inline struct dsa_port *dsa_to_port(struct dsa_switch *ds, int p)
@@ -98,6 +100,8 @@ static inline struct dsa_port *dsa_to_port(struct dsa_switch *ds, int p)
return ds->dp[p];
}
+extern struct list_head dsa_switch_list;
+
int dsa_register_switch(struct dsa_switch *ds);
u32 dsa_user_ports(struct dsa_switch *ds);
--
2.39.5
More information about the barebox
mailing list