From c2d6942233405686ee3754d2695a10676689fc01 Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Thu, 14 Sep 2023 15:24:25 -0700 Subject: [PATCH] modules/mqnic: Call devlink_register earlier Signed-off-by: Alex Forencich --- modules/mqnic/mqnic_main.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/mqnic/mqnic_main.c b/modules/mqnic/mqnic_main.c index b0b86c2ea..1e0f1efe8 100644 --- a/modules/mqnic/mqnic_main.c +++ b/modules/mqnic/mqnic_main.c @@ -245,6 +245,12 @@ static int mqnic_common_probe(struct mqnic_dev *mqnic) int k = 0, l = 0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) + devlink_register(devlink); +#else + devlink_register(devlink, dev); +#endif + // Enumerate registers mqnic->rb_list = mqnic_enumerate_reg_block_list(mqnic->hw_addr, 0, mqnic->hw_regs_size); if (!mqnic->rb_list) { @@ -441,11 +447,6 @@ fail_create_if: #endif // probe complete -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) - devlink_register(devlink); -#else - devlink_register(devlink, dev); -#endif return 0; // error handling @@ -465,8 +466,6 @@ static void mqnic_common_remove(struct mqnic_dev *mqnic) struct devlink *devlink = priv_to_devlink(mqnic); int k = 0; - devlink_unregister(devlink); - #ifdef CONFIG_AUXILIARY_BUS if (mqnic->app_adev) { auxiliary_device_delete(&mqnic->app_adev->adev); @@ -494,6 +493,8 @@ static void mqnic_common_remove(struct mqnic_dev *mqnic) } if (mqnic->rb_list) mqnic_free_reg_block_list(mqnic->rb_list); + + devlink_unregister(devlink); } #ifdef CONFIG_PCI