From patchwork Sat Sep 25 11:22:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 12517465 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCC9EC433FE for ; Sat, 25 Sep 2021 11:24:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF89E610F7 for ; Sat, 25 Sep 2021 11:24:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244918AbhIYL0A (ORCPT ); Sat, 25 Sep 2021 07:26:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:56278 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245431AbhIYLZ3 (ORCPT ); Sat, 25 Sep 2021 07:25:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 291B1610F7; Sat, 25 Sep 2021 11:23:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632569035; bh=8KdGOHxpJSC+PZ1rdlS7MYCY0+1MQwiYwEoCEiKpnEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CK0GxpGxVjLr6RMM+yLXjKxbrpzgr1NnmO2ZnSXdEbzjFggId6zMbRa/xFtmvhjFN mHKRHmRMWTn5ChvHLRZTYU+N7Q7pLuOMUtwQ6zn+pKMvS8zUMFcJGA2UcdEV1Fi8wM +c4uZH2zSGoVvfTMbgqPCMGxTnbFCubhs5kpa1HJVcrcL7pJP3UkPHw4dGdT6rOHzZ vWEjzOs1we9xOVQARO7alLjH6+/uytOgF3T8gLYPv/+La5k7Rs8Jacrqio9f7L7JMT bxer9M0yfSRvZLSv+yTlkpTRGW7BuRn3qYcG2CV5E719HbqtOGSCHbvHuDasNw5RTr DWyTQ/DNs4W6Q== 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 12/21] net: mscc: ocelot: delay devlink registration to the end Date: Sat, 25 Sep 2021 14:22:52 +0300 Message-Id: <6c20043398a8543fb69795be5ab1e200613fb881.1632565508.git.leonro@nvidia.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Leon Romanovsky Open access to the devlink interface when the driver fully initialized. Signed-off-by: Leon Romanovsky --- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index 2b8ea48d2fc4..5d01993f6be0 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -1134,7 +1134,6 @@ static int mscc_ocelot_probe(struct platform_device *pdev) if (err) goto out_put_ports; - devlink_register(devlink); err = mscc_ocelot_init_ports(pdev, ports); if (err) goto out_ocelot_devlink_unregister; @@ -1157,6 +1156,7 @@ static int mscc_ocelot_probe(struct platform_device *pdev) register_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb); of_node_put(ports); + devlink_register(devlink); dev_info(&pdev->dev, "Ocelot switch probed\n"); @@ -1166,7 +1166,6 @@ static int mscc_ocelot_probe(struct platform_device *pdev) mscc_ocelot_release_ports(ocelot); mscc_ocelot_teardown_devlink_ports(ocelot); out_ocelot_devlink_unregister: - devlink_unregister(devlink); ocelot_deinit(ocelot); out_put_ports: of_node_put(ports); @@ -1179,11 +1178,11 @@ static int mscc_ocelot_remove(struct platform_device *pdev) { struct ocelot *ocelot = platform_get_drvdata(pdev); + devlink_unregister(ocelot->devlink); ocelot_deinit_timestamp(ocelot); ocelot_devlink_sb_unregister(ocelot); mscc_ocelot_release_ports(ocelot); mscc_ocelot_teardown_devlink_ports(ocelot); - devlink_unregister(ocelot->devlink); ocelot_deinit(ocelot); unregister_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb); unregister_switchdev_notifier(&ocelot_switchdev_nb);