Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2330501pxb; Sat, 25 Sep 2021 04:29:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCk9DxaEPwv4sqzm5I+T/KEngBzzQ8BAoZKH+IKGmvZZF8SGDXNKr2AfLIkNSQvow6WpNS X-Received: by 2002:aa7:d99a:: with SMTP id u26mr10848234eds.320.1632569356050; Sat, 25 Sep 2021 04:29:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632569356; cv=none; d=google.com; s=arc-20160816; b=JSpESNBs5sAL7HkmgO1LZuq6XR5xj0vDS8wUZKndUCwunJQkLp4ULjvSzkXgwRx5dS 5zGpaix9I4xngohwPK53taLUegZOVsHSHtf4FBAXscesV93DM3e6ZgJBlg5XdnFIDHrC /fFY1EO8EHl1768lRVVxmI6dQmGXPOcNnpt4MW5Q35yZgTq285zb7lYu3g7Hv92Df0Ou 0qKgXVXa+lXJ7gxAnbM9ynSfuTZNWaxgd396JDID4eP02MUNHKReD82iIE/iDMNBZA/o gG9AS2ELKwpHybHpVWJLM0jt2fKdLC7SjGWgWpT/kntmOcQwobMnY5EMfo99vuZy49sj XqhA== 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=OemPh90VSOjtrnREM1Gaes4nBX1gQqjSzeDLoJP9GUY=; b=0ZlwEUbhf78yNFO6hy7xiR6DI75+ZwtvnQBL/PftgEfUNGrznO+oKdAcM0ICANf52r fcPqqrHEFqELwA0hJobAvExHa01vqcS5bB7ItvQFTD/gLOYBWRP4xXGCeoVorpLZFxTH QEkDFE2muD07qbNB+7/hRki41orTyk9JRd3zG1l/dqQp+V5fjJunk4uNTUBz6S2gdarR 5la4a08SHD5ASJZIDgg0awRlD/5j4ztgqnshj95utyAbpgw2OHz26mawrUS+UKbAMduq 42liKho0lvkU+NpExQC5JXVx+JbxUjyJnptJWUroqsF5RlXHXDHFCUWDdw0gPX+4bTnc h8Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SwqFg7wT; 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 da24si1548170edb.340.2021.09.25.04.28.52; Sat, 25 Sep 2021 04:29:16 -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=SwqFg7wT; 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 S1343855AbhIYL0O (ORCPT + 99 others); Sat, 25 Sep 2021 07:26:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:57154 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244574AbhIYLZj (ORCPT ); Sat, 25 Sep 2021 07:25:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 68AA66127C; Sat, 25 Sep 2021 11:24:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632569045; bh=ghHAU3D0r/NE4ZoiVTD12PA4CEB5+DDXgtVw+z6KtRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SwqFg7wTZGt5iCU3qK7f4wQnVFfowX010H/dNk0sKyf2Fpcrv5KOUcXlAIBhvhPoY /sJUWV49DzbUxeN8p6I3AF6ECdTN7PmNiEByCCKEnxzM+ANBeNrqDkUBsa8wvx7pjY l7gK1Mg98ck7OMfilfsXCN1BXu4T2LFhFzqSpS1+7D7Ik5V4yCfVtNXCTqVdBBLNgU RYeFsB5DtlzpqCfBNk5OFoaCcrIqNg2aZv4c8yF/fZrRpXnW24LDPNyQYqG2Q48wD7 ygTcKaPuygBRzHa5ObPnkA9FWV/kwePaSjWQtO8VR3EO/b6nHsGW0c+0vdXzTYphjW eun1aIUbsGYZg== 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 15/21] qed: Move devlink registration to be last devlink command Date: Sat, 25 Sep 2021 14:22:55 +0300 Message-Id: <01bc35bd99dc5d2dcbf55bbf4a86f0bde1c50087.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 This change prevents from users to access device before devlink is fully configured. Signed-off-by: Leon Romanovsky --- drivers/net/ethernet/qlogic/qed/qed_devlink.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_devlink.c b/drivers/net/ethernet/qlogic/qed/qed_devlink.c index c51f9590fe19..6bb4e165b592 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_devlink.c +++ b/drivers/net/ethernet/qlogic/qed/qed_devlink.c @@ -215,7 +215,6 @@ struct devlink *qed_devlink_register(struct qed_dev *cdev) qdevlink = devlink_priv(dl); qdevlink->cdev = cdev; - devlink_register(dl); rc = devlink_params_register(dl, qed_devlink_params, ARRAY_SIZE(qed_devlink_params)); if (rc) @@ -226,15 +225,13 @@ struct devlink *qed_devlink_register(struct qed_dev *cdev) QED_DEVLINK_PARAM_ID_IWARP_CMT, value); - devlink_params_publish(dl); cdev->iwarp_cmt = false; qed_fw_reporters_create(dl); - + devlink_register(dl); return dl; err_unregister: - devlink_unregister(dl); devlink_free(dl); return ERR_PTR(rc); @@ -245,11 +242,11 @@ void qed_devlink_unregister(struct devlink *devlink) if (!devlink) return; + devlink_unregister(devlink); qed_fw_reporters_destroy(devlink); devlink_params_unregister(devlink, qed_devlink_params, ARRAY_SIZE(qed_devlink_params)); - devlink_unregister(devlink); devlink_free(devlink); } -- 2.31.1