Skip to content

Commit

Permalink
devlink: use devl_is_registered() helper instead xa_get_mark()
Browse files Browse the repository at this point in the history
Instead of checking the xarray mark directly using xa_get_mark() helper
use devl_is_registered() helper which wraps it up. Note that there are
couple more users of xa_get_mark() left which are going to be handled
by the next patch.

Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
  • Loading branch information
Jiri Pirko authored and Paolo Abeni committed Dec 19, 2023
1 parent f7dd48e commit 337ad36
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions net/devlink/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static void devlink_notify(struct devlink *devlink, enum devlink_command cmd)
int err;

WARN_ON(cmd != DEVLINK_CMD_NEW && cmd != DEVLINK_CMD_DEL);
WARN_ON(!xa_get_mark(&devlinks, devlink->index, DEVLINK_REGISTERED));
WARN_ON(!devl_is_registered(devlink));

msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
if (!msg)
Expand Down Expand Up @@ -999,7 +999,7 @@ static void __devlink_flash_update_notify(struct devlink *devlink,
cmd != DEVLINK_CMD_FLASH_UPDATE_END &&
cmd != DEVLINK_CMD_FLASH_UPDATE_STATUS);

if (!xa_get_mark(&devlinks, devlink->index, DEVLINK_REGISTERED))
if (!devl_is_registered(devlink))
return;

msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
Expand Down
2 changes: 1 addition & 1 deletion net/devlink/rate.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static void devlink_rate_notify(struct devlink_rate *devlink_rate,

WARN_ON(cmd != DEVLINK_CMD_RATE_NEW && cmd != DEVLINK_CMD_RATE_DEL);

if (!xa_get_mark(&devlinks, devlink->index, DEVLINK_REGISTERED))
if (!devl_is_registered(devlink))
return;

msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
Expand Down
9 changes: 6 additions & 3 deletions net/devlink/trap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,8 @@ devlink_trap_group_notify(struct devlink *devlink,

WARN_ON_ONCE(cmd != DEVLINK_CMD_TRAP_GROUP_NEW &&
cmd != DEVLINK_CMD_TRAP_GROUP_DEL);
if (!xa_get_mark(&devlinks, devlink->index, DEVLINK_REGISTERED))

if (!devl_is_registered(devlink))
return;

msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
Expand Down Expand Up @@ -1234,7 +1235,8 @@ static void devlink_trap_notify(struct devlink *devlink,

WARN_ON_ONCE(cmd != DEVLINK_CMD_TRAP_NEW &&
cmd != DEVLINK_CMD_TRAP_DEL);
if (!xa_get_mark(&devlinks, devlink->index, DEVLINK_REGISTERED))

if (!devl_is_registered(devlink))
return;

msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
Expand Down Expand Up @@ -1710,7 +1712,8 @@ devlink_trap_policer_notify(struct devlink *devlink,

WARN_ON_ONCE(cmd != DEVLINK_CMD_TRAP_POLICER_NEW &&
cmd != DEVLINK_CMD_TRAP_POLICER_DEL);
if (!xa_get_mark(&devlinks, devlink->index, DEVLINK_REGISTERED))

if (!devl_is_registered(devlink))
return;

msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
Expand Down

0 comments on commit 337ad36

Please sign in to comment.