[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y7gaWTGHTwL5PIWn@nanopsycho>
Date: Fri, 6 Jan 2023 13:55:53 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, jacob.e.keller@...el.com
Subject: Re: [PATCH net-next 7/9] devlink: allow registering parameters after
the instance
Fri, Jan 06, 2023 at 07:34:00AM CET, kuba@...nel.org wrote:
>It's most natural to register the instance first and then its
>subobjects. Now that we can use the instance lock to protect
>the atomicity of all init - it should also be safe.
>
>Signed-off-by: Jakub Kicinski <kuba@...nel.org>
>---
> net/devlink/leftover.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
>diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c
>index 491f821c8b77..1e23b2da78cc 100644
>--- a/net/devlink/leftover.c
>+++ b/net/devlink/leftover.c
>@@ -5263,7 +5263,13 @@ static void devlink_param_notify(struct devlink *devlink,
> WARN_ON(cmd != DEVLINK_CMD_PARAM_NEW && cmd != DEVLINK_CMD_PARAM_DEL &&
> cmd != DEVLINK_CMD_PORT_PARAM_NEW &&
> cmd != DEVLINK_CMD_PORT_PARAM_DEL);
>- ASSERT_DEVLINK_REGISTERED(devlink);
>+
>+ /* devlink_notify_register() / devlink_notify_unregister()
>+ * will replay the notifications if the params are added/removed
>+ * outside of the lifetime of the instance.
>+ */
>+ if (!devl_is_registered(devlink))
>+ return;
This helper would be nice to use on other places as well.
Like devlink_trap_group_notify(), devlink_trap_notify() and others. I
will take care of that in a follow-up.
Reviewed-by: Jiri Pirko <jiri@...dia.com>
Powered by blists - more mailing lists