devlink: drop the filter argument from devlinks_xa_find_get
authorJakub Kicinski <kuba@kernel.org>
Thu, 5 Jan 2023 04:05:24 +0000 (20:05 -0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 6 Jan 2023 06:13:39 +0000 (22:13 -0800)
Looks like devlinks_xa_find_get() was intended to get the mark
from the @filter argument. It doesn't actually use @filter, passing
DEVLINK_REGISTERED to xa_find_fn() directly. Walking marks other
than registered is unlikely so drop @filter argument completely.

Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/devlink/core.c
net/devlink/devl_internal.h

index c084eafa17fbe967aeef2821ca8439be131213af..3a99bf84632e564ecbc40441d0198632c569a4ce 100644 (file)
@@ -92,7 +92,7 @@ void devlink_put(struct devlink *devlink)
 }
 
 static struct devlink *
-devlinks_xa_find_get(struct net *net, unsigned long *indexp, xa_mark_t filter,
+devlinks_xa_find_get(struct net *net, unsigned long *indexp,
                     void * (*xa_find_fn)(struct xarray *, unsigned long *,
                                          unsigned long, xa_mark_t))
 {
@@ -125,17 +125,15 @@ unlock:
 }
 
 struct devlink *
-devlinks_xa_find_get_first(struct net *net, unsigned long *indexp,
-                          xa_mark_t filter)
+devlinks_xa_find_get_first(struct net *net, unsigned long *indexp)
 {
-       return devlinks_xa_find_get(net, indexp, filter, xa_find);
+       return devlinks_xa_find_get(net, indexp, xa_find);
 }
 
 struct devlink *
-devlinks_xa_find_get_next(struct net *net, unsigned long *indexp,
-                         xa_mark_t filter)
+devlinks_xa_find_get_next(struct net *net, unsigned long *indexp)
 {
-       return devlinks_xa_find_get(net, indexp, filter, xa_find_after);
+       return devlinks_xa_find_get(net, indexp, xa_find_after);
 }
 
 /**
index 171219597cc68312cb2ae5bf5af9a048b9aff78f..86b321aef3ebca66b474d4af640fef3ae05dff31 100644 (file)
@@ -81,20 +81,15 @@ extern struct genl_family devlink_nl_family;
  * devlink_put() needs to be called for each iterated devlink pointer
  * in loop body in order to release the reference.
  */
-#define devlinks_xa_for_each_get(net, index, devlink, filter)          \
-       for (index = 0,                                                 \
-            devlink = devlinks_xa_find_get_first(net, &index, filter); \
-            devlink; devlink = devlinks_xa_find_get_next(net, &index, filter))
-
 #define devlinks_xa_for_each_registered_get(net, index, devlink)       \
-       devlinks_xa_for_each_get(net, index, devlink, DEVLINK_REGISTERED)
+       for (index = 0,                                                 \
+            devlink = devlinks_xa_find_get_first(net, &index); \
+            devlink; devlink = devlinks_xa_find_get_next(net, &index))
 
 struct devlink *
-devlinks_xa_find_get_first(struct net *net, unsigned long *indexp,
-                          xa_mark_t filter);
+devlinks_xa_find_get_first(struct net *net, unsigned long *indexp);
 struct devlink *
-devlinks_xa_find_get_next(struct net *net, unsigned long *indexp,
-                         xa_mark_t filter);
+devlinks_xa_find_get_next(struct net *net, unsigned long *indexp);
 
 /* Netlink */
 #define DEVLINK_NL_FLAG_NEED_PORT              BIT(0)