]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: dsa: move dsa_bridge_ports() helper to dsa.h
authorDaniel Golle <daniel@makrotopia.org>
Wed, 1 Apr 2026 13:34:30 +0000 (14:34 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 7 Apr 2026 01:30:33 +0000 (18:30 -0700)
The yt921x driver contains a helper to create a bitmap of ports
which are members of a bridge.

Move the helper as static inline function into dsa.h, so other driver
can make use of it as well.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Link: https://patch.msgid.link/4f8bbfce3e4e3a02064fc4dc366263136c6e0383.1775049897.git.daniel@makrotopia.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/yt921x.c
include/net/dsa.h

index 904613f4694ad5c029a2c14c5a07ee6c2ec8163d..5b66109ecc235daf182588477498bde5a7453f31 100644 (file)
@@ -2154,19 +2154,6 @@ yt921x_bridge_join(struct yt921x_priv *priv, int port, u16 ports_mask)
        return 0;
 }
 
-static u32
-dsa_bridge_ports(struct dsa_switch *ds, const struct net_device *bdev)
-{
-       struct dsa_port *dp;
-       u32 mask = 0;
-
-       dsa_switch_for_each_user_port(dp, ds)
-               if (dsa_port_offloads_bridge_dev(dp, bdev))
-                       mask |= BIT(dp->index);
-
-       return mask;
-}
-
 static int
 yt921x_bridge_flags(struct yt921x_priv *priv, int port,
                    struct switchdev_brport_flags flags)
index 6c17446f3dcc29682e07a70362bae8d8fa6233b0..e93b4feaca96667e004b6bb2081424362c490f28 100644 (file)
@@ -831,6 +831,19 @@ dsa_tree_offloads_bridge_dev(struct dsa_switch_tree *dst,
        return false;
 }
 
+static inline u32
+dsa_bridge_ports(struct dsa_switch *ds, const struct net_device *bdev)
+{
+       struct dsa_port *dp;
+       u32 mask = 0;
+
+       dsa_switch_for_each_user_port(dp, ds)
+               if (dsa_port_offloads_bridge_dev(dp, bdev))
+                       mask |= BIT(dp->index);
+
+       return mask;
+}
+
 static inline bool dsa_port_tree_same(const struct dsa_port *a,
                                      const struct dsa_port *b)
 {