realtek: Keep extern declaration in headers
authorSven Eckelmann <[email protected]>
Sun, 23 Nov 2025 13:12:52 +0000 (14:12 +0100)
committerHauke Mehrtens <[email protected]>
Mon, 24 Nov 2025 23:28:50 +0000 (00:28 +0100)
The common declarations should not be spread around in different source
files but kept inside the header files. This is unfortunately currently not
the best place to store them because soc_info is actually from non-DSA
code. But it is at least better than having them in diffent source files.

Signed-off-by: Sven Eckelmann <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <[email protected]>
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/qos.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl839x.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl83xx.h
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c
target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c
target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.h

index da57163dda73ac29dc6ff79d62e788c956d7d7fe..e04312a8a16c20e6b6c624354397429674227a16 100644 (file)
 
 #include "rtl83xx.h"
 
-extern struct rtl83xx_soc_info soc_info;
-
-extern const struct rtl838x_reg rtl838x_reg;
-extern const struct rtl838x_reg rtl839x_reg;
-extern const struct rtl838x_reg rtl930x_reg;
-extern const struct rtl838x_reg rtl931x_reg;
-
-extern const struct dsa_switch_ops rtl83xx_switch_ops;
-extern const struct dsa_switch_ops rtl93xx_switch_ops;
-
 struct phylink_pcs *rtpcs_create(struct device *dev, struct device_node *np, int port);
 
 int rtl83xx_port_get_stp_state(struct rtl838x_switch_priv *priv, int port)
index 70ca846af05279792283662332e6e72ae821a83f..f530673804ac6667e3fddcde9cdd1fdf626cef3a 100644 (file)
@@ -16,8 +16,6 @@ static const u8 ipv6_all_hosts_mcast_addr_base[ETH_ALEN] =
 static const u8 ipv6_all_hosts_mcast_addr_mask[ETH_ALEN] =
 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 
-extern struct rtl83xx_soc_info soc_info;
-
 static void rtldsa_init_counters(struct rtl838x_switch_priv *priv);
 static void rtldsa_port_xstp_state_set(struct rtl838x_switch_priv *priv, int port,
                                       u8 state, u16 mst_slot);
index f4255018ddae5a44f91fe8a312abfeae88d5ba69..8f5e74773020125fa810a4f604ccfb4664b92247 100644 (file)
@@ -7,7 +7,6 @@
 #include "rtl83xx.h"
 
 static struct rtl838x_switch_priv *switch_priv;
-extern struct rtl83xx_soc_info soc_info;
 
 enum scheduler_type {
        WEIGHTED_FAIR_QUEUE = 0,
index b578ffbb7eb0d84946796d13fb71f2c78ba48deb..9befe9799ab3d8182b7e1f00072ae4f611bc4d71 100644 (file)
@@ -20,8 +20,6 @@
 #define RTL839X_VLAN_PORT_TAG_STS_CTRL_IGR_P_OTAG_KEEP_MASK    GENMASK(1,1)
 #define RTL839X_VLAN_PORT_TAG_STS_CTRL_IGR_P_ITAG_KEEP_MASK    GENMASK(0,0)
 
-extern struct rtl83xx_soc_info soc_info;
-
 /* Definition of the RTL839X-specific template field IDs as used in the PIE */
 enum template_field_id {
        TEMPLATE_FIELD_SPMMASK = 0,
index 1b04c657088c7a0d75a2173eb915ab6064905016..eb09d936b4a9fd823f10301a92b9328afe44387a 100644 (file)
@@ -207,4 +207,15 @@ void rtl930x_pie_rule_dump_raw(u32 r[]);
 
 void rtl931x_print_matrix(void);
 
+extern const struct dsa_switch_ops rtl83xx_switch_ops;
+extern const struct dsa_switch_ops rtl93xx_switch_ops;
+
+extern const struct rtl838x_reg rtl838x_reg;
+extern const struct rtl838x_reg rtl839x_reg;
+extern const struct rtl838x_reg rtl930x_reg;
+extern const struct rtl838x_reg rtl931x_reg;
+
+/* TODO actually from arch/mips/rtl838x/prom.c */
+extern struct rtl83xx_soc_info soc_info;
+
 #endif /* _NET_DSA_RTL83XX_H */
index c6b03c81b762f2ca73679738a0f98156ec902f47..aefce4293f86d69f835441c5afcf965f117f4898 100644 (file)
@@ -33,8 +33,6 @@
 /* get shift for given led in any set */
 #define RTL930X_LED_SET_LEDX_SHIFT(x) (16 * (x % 2))
 
-extern struct rtl83xx_soc_info soc_info;
-
 /* Definition of the RTL930X-specific template field IDs as used in the PIE */
 enum template_field_id {
        TEMPLATE_FIELD_SPM0 = 0,                /* Source portmask ports 0-15 */
index bfdd45e7b3c15ca8fa25e439adf762cc189edf3b..574218d5b4cd191c4b0487da2fee4849bf52f1a2 100644 (file)
@@ -25,8 +25,6 @@
 #define RTL931X_VLAN_PORT_TAG_ITPID_IDX_MASK                   GENMASK(2,1)
 #define RTL931X_VLAN_PORT_TAG_ITPID_KEEP_MASK                  GENMASK(0,0)
 
-extern struct rtl83xx_soc_info soc_info;
-
 /* Definition of the RTL931X-specific template field IDs as used in the PIE */
 enum template_field_id {
        TEMPLATE_FIELD_SPM0 = 1,
index 11aa031804d3af054357a9cbc664bfcafa27d68d..d9c0fb16a38066d8f94f0dad6ef71efdcc37e73b 100644 (file)
@@ -23,8 +23,6 @@
 #include <asm/mach-rtl838x/mach-rtl83xx.h>
 #include "rtl838x_eth.h"
 
-extern struct rtl83xx_soc_info soc_info;
-
 int rtl83xx_setup_tc(struct net_device *dev, enum tc_setup_type type, void *type_data);
 
 /* Maximum number of RX rings is 8 on RTL83XX and 32 on the 93XX
index f220a4dd64da58be6fbd348d88fa00e5c9a47ca9..e66a4083cf20f1246a41b4f683b2171ee643f856 100644 (file)
@@ -469,4 +469,7 @@ struct rtl838x_eth_reg {
        bool (*decode_tag)(struct p_hdr *h, struct dsa_tag *tag);
 };
 
+/* TODO actually from arch/mips/rtl838x/prom.c */
+extern struct rtl83xx_soc_info soc_info;
+
 #endif /* _RTL838X_ETH_H */