]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: dsa: b53: split reading search entry into their own functions
authorJonas Gorski <jonas.gorski@gmail.com>
Fri, 7 Nov 2025 08:07:46 +0000 (09:07 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 11 Nov 2025 01:11:07 +0000 (17:11 -0800)
Split reading search entries into a function for each format.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://patch.msgid.link/20251107080749.26936-6-jonas.gorski@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/b53/b53_common.c

index b13437ea21a09d3705385d2a4fc92e14e9ea721d..fa4cf6ceddb8c445e05edebacddbc8855cf6099d 100644 (file)
@@ -2076,28 +2076,48 @@ static int b53_arl_search_wait(struct b53_device *dev)
        return -ETIMEDOUT;
 }
 
-static void b53_arl_search_rd(struct b53_device *dev, u8 idx,
-                             struct b53_arl_entry *ent)
+static void b53_arl_search_read_25(struct b53_device *dev, u8 idx,
+                                  struct b53_arl_entry *ent)
 {
        u64 mac_vid;
 
-       if (is5325(dev)) {
-               b53_read64(dev, B53_ARLIO_PAGE, B53_ARL_SRCH_RSTL_0_MACVID_25,
-                          &mac_vid);
-               b53_arl_to_entry_25(ent, mac_vid);
-       } else if (is5365(dev)) {
-               b53_read64(dev, B53_ARLIO_PAGE, B53_ARL_SRCH_RSTL_0_MACVID_65,
-                          &mac_vid);
-               b53_arl_to_entry_25(ent, mac_vid);
-       } else {
-               u32 fwd_entry;
+       b53_read64(dev, B53_ARLIO_PAGE, B53_ARL_SRCH_RSTL_0_MACVID_25,
+                  &mac_vid);
+       b53_arl_to_entry_25(ent, mac_vid);
+}
 
-               b53_read64(dev, B53_ARLIO_PAGE, B53_ARL_SRCH_RSTL_MACVID(idx),
-                          &mac_vid);
-               b53_read32(dev, B53_ARLIO_PAGE, B53_ARL_SRCH_RSTL(idx),
-                          &fwd_entry);
-               b53_arl_to_entry(ent, mac_vid, fwd_entry);
-       }
+static void b53_arl_search_read_65(struct b53_device *dev, u8 idx,
+                                  struct b53_arl_entry *ent)
+{
+       u64 mac_vid;
+
+       b53_read64(dev, B53_ARLIO_PAGE, B53_ARL_SRCH_RSTL_0_MACVID_65,
+                  &mac_vid);
+       b53_arl_to_entry_25(ent, mac_vid);
+}
+
+static void b53_arl_search_read_95(struct b53_device *dev, u8 idx,
+                                  struct b53_arl_entry *ent)
+{
+       u32 fwd_entry;
+       u64 mac_vid;
+
+       b53_read64(dev, B53_ARLIO_PAGE, B53_ARL_SRCH_RSTL_MACVID(idx),
+                  &mac_vid);
+       b53_read32(dev, B53_ARLIO_PAGE, B53_ARL_SRCH_RSTL(idx),
+                  &fwd_entry);
+       b53_arl_to_entry(ent, mac_vid, fwd_entry);
+}
+
+static void b53_arl_search_rd(struct b53_device *dev, u8 idx,
+                             struct b53_arl_entry *ent)
+{
+       if (is5325(dev))
+               b53_arl_search_read_25(dev, idx, ent);
+       else if (is5365(dev))
+               b53_arl_search_read_65(dev, idx, ent);
+       else
+               b53_arl_search_read_95(dev, idx, ent);
 }
 
 static int b53_fdb_copy(int port, const struct b53_arl_entry *ent,