From patchwork Sat Sep 25 11:22:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 12517421 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 3C425C433F5 for ; Sat, 25 Sep 2021 11:24:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C1F661359 for ; Sat, 25 Sep 2021 11:24:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244666AbhIYLZ4 (ORCPT ); Sat, 25 Sep 2021 07:25:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:56760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244902AbhIYLZ0 (ORCPT ); Sat, 25 Sep 2021 07:25:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B775B6128C; Sat, 25 Sep 2021 11:23:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632569031; bh=xa9GziJGjO+uYR+6TLvwaU0ghnPSlFl4J+UcvATj0rM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sh5UCjWPwOf2FQDfkuASXPFp/fNpsJHp5uxIvwgGsrxq4+tYmgNyYTY30hIF2jbP0 FOZ80qEQnPV2vSc/Tv9uRTO+IDefIr7Ysc8W8FcVPJN+HViEyz0m7eIWHdt93GGo7a HUrEErXyzrYmBaJadre4duxUrAj/tJVTh87LQS1CSQKHDIS5bxRigi/BGcuLTlSoS+ A2HJqVcXKjt75hbAM8bIVgc2/Si6Ibd7nFYBFjBLt18A+LxshbWa+yxcfHNJVBVQJI xKOy57wtXFbtDXyaPBt9Cb5QkNXwWVIEDUXaffiJAl8dT224YWEEmPlxFFRh61STQw jkPCR4A3oV7nA== 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 14/21] ionic: Move devlink registration to be last devlink command Date: Sat, 25 Sep 2021 14:22:54 +0300 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Leon Romanovsky This change prevents from users to access device before devlink is fully configured. Signed-off-by: Leon Romanovsky Acked-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic_devlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c index 93282394d332..2267da95640b 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c @@ -82,7 +82,6 @@ int ionic_devlink_register(struct ionic *ionic) struct devlink_port_attrs attrs = {}; int err; - devlink_register(dl); attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL; devlink_port_attrs_set(&ionic->dl_port, &attrs); err = devlink_port_register(dl, &ionic->dl_port, 0); @@ -93,6 +92,7 @@ int ionic_devlink_register(struct ionic *ionic) } devlink_port_type_eth_set(&ionic->dl_port, ionic->lif->netdev); + devlink_register(dl); return 0; } @@ -100,6 +100,6 @@ void ionic_devlink_unregister(struct ionic *ionic) { struct devlink *dl = priv_to_devlink(ionic); - devlink_port_unregister(&ionic->dl_port); devlink_unregister(dl); + devlink_port_unregister(&ionic->dl_port); }