Commit 8861c093 authored by Jakub Kicinski's avatar Jakub Kicinski

devlink: drop the filter argument from devlinks_xa_find_get

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: default avatarJiri Pirko <jiri@nvidia.com>
Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 20615659
...@@ -92,7 +92,7 @@ void devlink_put(struct devlink *devlink) ...@@ -92,7 +92,7 @@ void devlink_put(struct devlink *devlink)
} }
static struct 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 *, void * (*xa_find_fn)(struct xarray *, unsigned long *,
unsigned long, xa_mark_t)) unsigned long, xa_mark_t))
{ {
...@@ -125,17 +125,15 @@ devlinks_xa_find_get(struct net *net, unsigned long *indexp, xa_mark_t filter, ...@@ -125,17 +125,15 @@ devlinks_xa_find_get(struct net *net, unsigned long *indexp, xa_mark_t filter,
} }
struct devlink * struct devlink *
devlinks_xa_find_get_first(struct net *net, unsigned long *indexp, devlinks_xa_find_get_first(struct net *net, unsigned long *indexp)
xa_mark_t filter)
{ {
return devlinks_xa_find_get(net, indexp, filter, xa_find); return devlinks_xa_find_get(net, indexp, xa_find);
} }
struct devlink * struct devlink *
devlinks_xa_find_get_next(struct net *net, unsigned long *indexp, devlinks_xa_find_get_next(struct net *net, unsigned long *indexp)
xa_mark_t filter)
{ {
return devlinks_xa_find_get(net, indexp, filter, xa_find_after); return devlinks_xa_find_get(net, indexp, xa_find_after);
} }
/** /**
......
...@@ -81,20 +81,15 @@ extern struct genl_family devlink_nl_family; ...@@ -81,20 +81,15 @@ extern struct genl_family devlink_nl_family;
* devlink_put() needs to be called for each iterated devlink pointer * devlink_put() needs to be called for each iterated devlink pointer
* in loop body in order to release the reference. * 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) \ #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 * struct devlink *
devlinks_xa_find_get_first(struct net *net, unsigned long *indexp, devlinks_xa_find_get_first(struct net *net, unsigned long *indexp);
xa_mark_t filter);
struct devlink * struct devlink *
devlinks_xa_find_get_next(struct net *net, unsigned long *indexp, devlinks_xa_find_get_next(struct net *net, unsigned long *indexp);
xa_mark_t filter);
/* Netlink */ /* Netlink */
#define DEVLINK_NL_FLAG_NEED_PORT BIT(0) #define DEVLINK_NL_FLAG_NEED_PORT BIT(0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment