summaryrefslogtreecommitdiff
path: root/devlink
diff options
context:
space:
mode:
authorJiri Pirko <jiri@nvidia.com>2022-12-05 13:21:57 +0100
committerDavid Ahern <dsahern@kernel.org>2022-12-08 10:47:44 -0700
commit18ff3ccbc8535fe3cb8319eebc097e50d326632d (patch)
treea5972d50102fa2e1f5c7d2ca0ea558c7f6e31e5a /devlink
parentd5ae4c3fdba8959a9adc74054701671268b442f2 (diff)
downloadiproute2-18ff3ccbc8535fe3cb8319eebc097e50d326632d.tar.gz
devlink: push common code to __pr_out_port_handle_start_tb()
There is a common code in pr_out_port_handle_start() and pr_out_port_handle_start_arr(). As the next patch is going to extend it even more, push the code into common helper. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Diffstat (limited to 'devlink')
-rw-r--r--devlink/devlink.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/devlink/devlink.c b/devlink/devlink.c
index af5f1403..93d83a07 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -2764,7 +2764,8 @@ static void __pr_out_port_handle_start(struct dl *dl, const char *bus_name,
}
}
-static void pr_out_port_handle_start(struct dl *dl, struct nlattr **tb, bool try_nice)
+static void __pr_out_port_handle_start_tb(struct dl *dl, struct nlattr **tb,
+ bool try_nice, bool array)
{
const char *bus_name;
const char *dev_name;
@@ -2773,19 +2774,17 @@ static void pr_out_port_handle_start(struct dl *dl, struct nlattr **tb, bool try
bus_name = mnl_attr_get_str(tb[DEVLINK_ATTR_BUS_NAME]);
dev_name = mnl_attr_get_str(tb[DEVLINK_ATTR_DEV_NAME]);
port_index = mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_INDEX]);
- __pr_out_port_handle_start(dl, bus_name, dev_name, port_index, try_nice, false);
+ __pr_out_port_handle_start(dl, bus_name, dev_name, port_index, try_nice, array);
}
-static void pr_out_port_handle_start_arr(struct dl *dl, struct nlattr **tb, bool try_nice)
+static void pr_out_port_handle_start(struct dl *dl, struct nlattr **tb, bool try_nice)
{
- const char *bus_name;
- const char *dev_name;
- uint32_t port_index;
+ __pr_out_port_handle_start_tb(dl, tb, try_nice, false);
+}
- bus_name = mnl_attr_get_str(tb[DEVLINK_ATTR_BUS_NAME]);
- dev_name = mnl_attr_get_str(tb[DEVLINK_ATTR_DEV_NAME]);
- port_index = mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_INDEX]);
- __pr_out_port_handle_start(dl, bus_name, dev_name, port_index, try_nice, true);
+static void pr_out_port_handle_start_arr(struct dl *dl, struct nlattr **tb, bool try_nice)
+{
+ __pr_out_port_handle_start_tb(dl, tb, try_nice, true);
}
static void pr_out_port_handle_end(struct dl *dl)