Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2328788pxb; Sat, 25 Sep 2021 04:26:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxmxLEno/40AOm02TMWhp1FX/FJHh7jgYfSIgq1Wc0xFHsvXpSMZIi+vpa4QjvHuG44dkF X-Received: by 2002:a17:906:38ce:: with SMTP id r14mr16244653ejd.268.1632569194859; Sat, 25 Sep 2021 04:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632569194; cv=none; d=google.com; s=arc-20160816; b=fPq3kaQLYsUunYfg7QoChv0k684RUKldHjAdMr5oKoNTHN4twLW37QdofygDC+9kNE w09znGIuxfIrOo0qi4fdi9Rp9/BqVBTmU0Jro7aXcoj3FHn1sfmvBI0cigmXYLdxa90x JrLufiD/0DRk7sVJo2B4s0cnH15hKCUiILxm3sxTS12AOBY7aBqMlMVcbZAIaAHvJd1C lIGIN26KvZHDpiWV3C+yXH2OcLuwMwjObq2mw91C4cV47k9jlHDr7sswo37nh5mLh9mf aTwueKjCXngbnkdWxennzZuKUUTFgaKwcIQDVvYcLE0JDTubWpT20I40ZyazzFNEquzo isbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8V1xltzct8wGKY1YNoHA4DyIdq1o3oF9DOW+TtdpH2c=; b=yGiTTul9T6PlNWPZVUQ9/pSRxrjWH6bG2ZCGGHxJFEhh2Wfltb3GiwJ0+E7ikVISOs /GY+gWOn1KIxQHKdKejP3doIyG1nZR7VtIgGR1znW/A7roQ4Tw9ZPoquhRuWo5/xYner v7zBw5mu+gV4J+2P3XG5DW+y5CF2ksT+W5JE3bIhtKwp0dUusHg9pGe+0H6nUL/UxaCQ Nlv2jM5YrSb+VkH5z7r4s5e5hvcSWbWdxpq2MQos2+obO0l0pCDDeYKgl+VzS488W7KE 84ETCqPv0EyvhhKVQYpr2CrRfSsm6pk8ccARGkjl+Hf5H93mq9o5gkq1FDxP86jarQd2 ltAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Oa0/myPI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s11si7535381edh.403.2021.09.25.04.26.11; Sat, 25 Sep 2021 04:26:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Oa0/myPI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244930AbhIYLZk (ORCPT + 99 others); Sat, 25 Sep 2021 07:25:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:56468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245264AbhIYLZT (ORCPT ); Sat, 25 Sep 2021 07:25:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 862F36128E; Sat, 25 Sep 2021 11:23:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632569024; bh=PrFeKKukywHaBt62rZVuiu0/Btho0nWbpbcpWAnFbY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oa0/myPIOe/XULQJv4GvGl6mM8d548pm5n1JM2ZO4N/GjQ3/SuiSVVQurEYxdOB4t cZavrhNx8GlJtSu+x4nmb8Qvyu+Rk1v7w7H71NzrI9xMf/ssB9cYB9TnrGB5M2suOR Vat9GDPaYU2bERyJfmRXqyWB6h+dnwTtaTrkn5Q6SxLBsL5XEVF1ViKGb16wvvlRmz oYUHPaJKGU9BCOODfK4K/2mNPBd5BekedAnYvyI+U4XbQRpNV3I/TzHLtLg4XjXbUA 3gb2u9jQ78tP5MnQQFI9e1+58aJKFPormH8cYFnoCewvS6S9P6VtOtPHaWiU4iR5ky WySvKEg7HrWMQ== From: Leon Romanovsky To: "David S . Miller" , Jakub Kicinski Cc: Leon Romanovsky , Alexandre Belloni , Andrew Lunn , Ariel Elior , Bin Luo , Claudiu Manoil , Coiby Xu , Derek Chickles , drivers@pensando.io, Felix Manlunas , Florian Fainelli , Geetha sowjanya , Greg Kroah-Hartman , GR-everest-linux-l2@marvell.com, GR-Linux-NIC-Dev@marvell.com, hariprasad , Ido Schimmel , Intel Corporation , intel-wired-lan@lists.osuosl.org, Ioana Ciornei , Jerin Jacob , Jesse Brandeburg , Jiri Pirko , Jonathan Lemon , Linu Cherian , linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-rdma@vger.kernel.org, linux-staging@lists.linux.dev, Loic Poulain , Manish Chopra , M Chetan Kumar , Michael Chan , Michael Guralnik , netdev@vger.kernel.org, oss-drivers@corigine.com, Richard Cochran , Saeed Mahameed , Satanand Burla , Sergey Ryazanov , Shannon Nelson , Simon Horman , Subbaraya Sundeep , Sunil Goutham , Taras Chornyi , Tariq Toukan , Tony Nguyen , UNGLinuxDriver@microchip.com, Vadym Kochan , Vivien Didelot , Vladimir Oltean Subject: [PATCH net-next v1 09/21] net/mlx4: Move devlink_register to be the last initialization command Date: Sat, 25 Sep 2021 14:22:49 +0300 Message-Id: <486f4512a0d472b8732067018d2ec8c4f3f45763.1632565508.git.leonro@nvidia.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leon Romanovsky Refactor the code to make sure that devlink_register() is the last command during initialization stage. Signed-off-by: Leon Romanovsky --- drivers/net/ethernet/mellanox/mlx4/main.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 27ed4694fbea..9541f3a920c8 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c @@ -4015,7 +4015,6 @@ static int mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) mutex_init(&dev->persist->interface_state_mutex); mutex_init(&dev->persist->pci_status_mutex); - devlink_register(devlink); ret = devlink_params_register(devlink, mlx4_devlink_params, ARRAY_SIZE(mlx4_devlink_params)); if (ret) @@ -4025,16 +4024,15 @@ static int mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id) if (ret) goto err_params_unregister; - devlink_params_publish(devlink); - devlink_reload_enable(devlink); pci_save_state(pdev); + devlink_register(devlink); + devlink_reload_enable(devlink); return 0; err_params_unregister: devlink_params_unregister(devlink, mlx4_devlink_params, ARRAY_SIZE(mlx4_devlink_params)); err_devlink_unregister: - devlink_unregister(devlink); kfree(dev->persist); err_devlink_free: devlink_free(devlink); @@ -4138,6 +4136,7 @@ static void mlx4_remove_one(struct pci_dev *pdev) int active_vfs = 0; devlink_reload_disable(devlink); + devlink_unregister(devlink); if (mlx4_is_slave(dev)) persist->interface_state |= MLX4_INTERFACE_STATE_NOWAIT; @@ -4173,7 +4172,6 @@ static void mlx4_remove_one(struct pci_dev *pdev) mlx4_pci_disable_device(dev); devlink_params_unregister(devlink, mlx4_devlink_params, ARRAY_SIZE(mlx4_devlink_params)); - devlink_unregister(devlink); kfree(dev->persist); devlink_free(devlink); } -- 2.31.1