linux/net/devlink
Johannes Berg a885a6b2d3 net: convert to nla_get_*_default()
Most of the original conversion is from the spatch below,
but I edited some and left out other instances that were
either buggy after conversion (where default values don't
fit into the type) or just looked strange.

    @@
    expression attr, def;
    expression val;
    identifier fn =~ "^nla_get_.*";
    fresh identifier dfn = fn ## "_default";
    @@
    (
    -if (attr)
    -  val = fn(attr);
    -else
    -  val = def;
    +val = dfn(attr, def);
    |
    -if (!attr)
    -  val = def;
    -else
    -  val = fn(attr);
    +val = dfn(attr, def);
    |
    -if (!attr)
    -  return def;
    -return fn(attr);
    +return dfn(attr, def);
    |
    -attr ? fn(attr) : def
    +dfn(attr, def)
    |
    -!attr ? def : fn(attr)
    +dfn(attr, def)
    )

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Toke Høiland-Jørgensen <toke@kernel.org>
Link: https://patch.msgid.link/20241108114145.0580b8684e7f.I740beeaa2f70ebfc19bfca1045a24d6151992790@changeid
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-11-11 10:32:06 -08:00
..
core.c devlink: use kvzalloc() to allocate devlink instance resources 2024-03-29 12:24:38 -07:00
dev.c net: convert to nla_get_*_default() 2024-11-11 10:32:06 -08:00
devl_internal.h devlink: introduce devlink_nl_put_u64() 2024-10-29 16:52:56 -07:00
dpipe.c devlink: use devlink_nl_put_u64() helper 2024-10-29 16:52:56 -07:00
health.c devlink: use devlink_nl_put_u64() helper 2024-10-29 16:52:56 -07:00
linecard.c devlink: introduce a helper for netlink multicast send 2023-12-19 15:31:40 +01:00
Makefile devlink: move devlink_notify_register/unregister() to dev.c 2023-08-28 08:02:24 -07:00
netlink_gen.c devlink: Fix length of eswitch inline-mode 2024-03-11 13:13:53 -07:00
netlink_gen.h devlink: add a command to set notification filter and use it for multicasts 2023-12-19 15:31:40 +01:00
netlink.c devlink: Fix devlink parallel commands processing 2024-03-13 08:31:40 +00:00
param.c devlink: extend devlink_param *set pointer 2024-04-22 13:05:19 -07:00
port.c devlink: Support setting max_io_eqs 2024-04-08 14:10:45 +01:00
rate.c devlink: use devlink_nl_put_u64() helper 2024-10-29 16:52:56 -07:00
region.c devlink: region: snapshot IDs: consolidate error values 2024-10-29 16:52:57 -07:00
resource.c devlink: remove unused devlink_resource_register() 2024-10-29 16:52:57 -07:00
sb.c devlink: rename netlink callback to be aligned with the generated ones 2023-10-23 16:12:47 -07:00
trap.c devlink: use devlink_nl_put_u64() helper 2024-10-29 16:52:56 -07:00