[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221205122158.437522-4-jiri@resnulli.us>
Date: Mon, 5 Dec 2022 13:21:57 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: stephen@...workplumber.org, dsahern@...il.com, kuba@...nel.org,
moshe@...dia.com, saeedm@...dia.com
Subject: [patch iproute2/net-next 3/4] devlink: push common code to __pr_out_port_handle_start_tb()
From: Jiri Pirko <jiri@...dia.com>
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@...dia.com>
---
devlink/devlink.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 80c18d690c10..2d9ba32b4140 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)
--
2.37.3
Powered by blists - more mailing lists