Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2329813pxb; Sat, 25 Sep 2021 04:28:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtYEYkjG9TP1qvMvDyfIr5fgkqcimqv8Oq/uGU079lJX29wt6Py1E3C8oKl5/0sFf22U02 X-Received: by 2002:a17:907:9854:: with SMTP id jj20mr16934796ejc.133.1632569282183; Sat, 25 Sep 2021 04:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632569282; cv=none; d=google.com; s=arc-20160816; b=yaKU20dJOo+Wze4I4SEjW6K8fPn068JbDaSXSQwQRWyIPekUrKKZfAsDLlGSkc0ZqS iFc0JZw5H2t35MqfcFHaOCUFEDryyNAeeXtLuU/PXsQUcikWR2aSxWqyHYCxCU6cBK/u lqtQGQSzMTUl9EHZll7AcgULKQCiDkdJ9P/5ae//VXJcKV3uHjo6MyhjyXxIVjfoIMHn j6jpiD13h6f8V8wb7UHvEiPygaAeZO6ECtuG2LirNlv/1o8FVUnMmX706gQ9jkKQClI5 H72yy8ytnWvUMGS2AFGHF6jsVESu6jL1YP7SIqP0LKzOsgU5TxvI1LTlYja2+/vH0nu9 LE6Q== 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=jEI1oJ8vQJrWLbmOGQFDIfZWKIT0t6W1+j1t9R2DS8U=; b=BJ7VfUoxatRFpfvRwhwnNc2mAp+h8mEiys3KLEZ6o9LQojE+27ABhX0MlV6gPr6sW4 teAGvQWhQrNh33vluiuRfx3NuWgyE1whddGuAxXklyD6XsRVotS6+sHH/b8T1/FdmrL1 wj2UFFClT2BkbgADh5AfOz6S0iIWHPNji1ZxjJZO3O03UkbYZeD00bJREINizWpGhAp7 J53gRiRg2tXk0cls2Trc2FM6Ak29bSTh7WFX//4g55/aJQR8R3BD0mBy/gugLvQL3g2J Z5rrUWNsutaLbqIcFatk/J+S+VPUjYZxhMo7WnKe38880Czc9nEU0pGgckJg2Cixrf4f CZLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bl6F2XX2; 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 hp20si3086929ejc.560.2021.09.25.04.27.39; Sat, 25 Sep 2021 04:28:02 -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=bl6F2XX2; 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 S1343621AbhIYLZw (ORCPT + 99 others); Sat, 25 Sep 2021 07:25:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:56594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245343AbhIYLZW (ORCPT ); Sat, 25 Sep 2021 07:25:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4D4856128B; Sat, 25 Sep 2021 11:23:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632569028; bh=PMH85H5qipZOBKpjQUuS38xXXX8zD2iZVNUxRrzSq2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bl6F2XX2QrtGJ/goSxrWiZ4kTfaDRalUW+JX64R4+f5tX2MkVbudqMboMu4+2r17G 9ypRSr6/TbxTX5ORpt0WdmEFf4Q9lTCPiz+FKtPuz9OazWtk3RxYg4dOQIG3qJItpb pbsdhwETQqV8zGIh6DTOueiiB6dX2qdXhef22O55T8LHb5HQ/oDZd4nwPrZj/bqO7m JhHZtPN0ApEbgjNw6XG7w2GgfEOi/wJOq/MBu65oKBl7Ftd6PTsLr9J/BfEnVlCops Kpqi2qjOoxhp/Ux5Aml2oWUSJR2F3fXuK8NnJcOU5kQF7HvO859ztbO8XzHL22qlxH S0xx6v652WI1Q== 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 13/21] nfp: Move delink_register to be last command Date: Sat, 25 Sep 2021 14:22:53 +0300 Message-Id: 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 Open user space access to the devlink after driver is probed. Signed-off-by: Leon Romanovsky --- drivers/net/ethernet/netronome/nfp/devlink_param.c | 9 ++------- drivers/net/ethernet/netronome/nfp/nfp_net_main.c | 5 ++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/devlink_param.c b/drivers/net/ethernet/netronome/nfp/devlink_param.c index 36491835ac65..db297ee4d7ad 100644 --- a/drivers/net/ethernet/netronome/nfp/devlink_param.c +++ b/drivers/net/ethernet/netronome/nfp/devlink_param.c @@ -233,13 +233,8 @@ int nfp_devlink_params_register(struct nfp_pf *pf) if (err <= 0) return err; - err = devlink_params_register(devlink, nfp_devlink_params, - ARRAY_SIZE(nfp_devlink_params)); - if (err) - return err; - - devlink_params_publish(devlink); - return 0; + return devlink_params_register(devlink, nfp_devlink_params, + ARRAY_SIZE(nfp_devlink_params)); } void nfp_devlink_params_unregister(struct nfp_pf *pf) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c index 616872928ada..5fbb7c613ff1 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c @@ -701,7 +701,6 @@ int nfp_net_pci_probe(struct nfp_pf *pf) if (err) goto err_unmap; - devlink_register(devlink); err = nfp_shared_buf_register(pf); if (err) goto err_devlink_unreg; @@ -731,6 +730,7 @@ int nfp_net_pci_probe(struct nfp_pf *pf) goto err_stop_app; mutex_unlock(&pf->lock); + devlink_register(devlink); return 0; @@ -748,7 +748,6 @@ int nfp_net_pci_probe(struct nfp_pf *pf) nfp_shared_buf_unregister(pf); err_devlink_unreg: cancel_work_sync(&pf->port_refresh_work); - devlink_unregister(devlink); nfp_net_pf_app_clean(pf); err_unmap: nfp_net_pci_unmap_mem(pf); @@ -759,6 +758,7 @@ void nfp_net_pci_remove(struct nfp_pf *pf) { struct nfp_net *nn, *next; + devlink_unregister(priv_to_devlink(pf)); mutex_lock(&pf->lock); list_for_each_entry_safe(nn, next, &pf->vnics, vnic_list) { if (!nfp_net_is_data_vnic(nn)) @@ -775,7 +775,6 @@ void nfp_net_pci_remove(struct nfp_pf *pf) nfp_devlink_params_unregister(pf); nfp_shared_buf_unregister(pf); - devlink_unregister(priv_to_devlink(pf)); nfp_net_pf_free_irqs(pf); nfp_net_pf_app_clean(pf); -- 2.31.1