Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2328615pxb; Sat, 25 Sep 2021 04:26:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJya33dLld6auiALcI071rEb0sWh+yAAg+dHF0gtbMIOB8SEUsDiMagHHLCxba+TQAkS+lcH X-Received: by 2002:a05:6402:6d6:: with SMTP id n22mr10876691edy.257.1632569179061; Sat, 25 Sep 2021 04:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632569179; cv=none; d=google.com; s=arc-20160816; b=cmHVVuj7TqkQj/TgVwqdFgyjy4P1ij4eNofZOyaqp+Kc34ezsDKI9Uo0nTw4NNZ/dG XTgTzD9nB4Q/srzc6hoXv8c8kZ7gcCtJDe+AUSca5vrrFpSuFFBHBSte1O4FjlgF3cEA Dfs+wiypsppCc/KmdvlVEUFDa2eaAX64xaR1Ap6hl1SP87ivPS5hV0SapQri00i9tok3 3+1aI1Z4LHZyuV9UCaVthZD/keFmsiM9ZI+A1/Iw4SgpJoJ3+MTLdBzIxIpyxsajcDVz AzTqzFfPZvK5XdJVyxvDf5tnCDqTHMcDL7jfT3LseUm3+TUg7totmfkJyvmj8YMUe3/t rtnw== 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=xJKG+iORNTJ+sYiqZUGpJ2NGIVyMRUEpZfcQraO2JEM=; b=jtrOQF7gjso4M0gHIc5sk0GhLAQuEvE9xlUg5pZfdAC/hULvOSl2tEOD0sI+TmhZHI neMdeNkiR7hQcpS+Ad5j+Fv2pXwPWbozGePDrK9MtvL2dP4iq6ef9x2yUZuERQjoMkmI 3ByJgXPmJbAx5lgYVZ1463e1Z65+IB10dJiCWEy1ldEbZ7ozxcUNsWrT77dS8sOwTcKO 1MQi/4rJBgUdv4VIcAh9gH3mplkMlQi9DwgXw+apUbSvYW+AqjIJOnZ978zmARdihD33 FI0uj4xNR4E1e1aj4Qc6FwYdN9L8KiNB3Ggrh9TPS7ZolmqZsLfr0s284ERPjk3HfY7z B3BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WQR4ljxZ; 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 s25si2802585ejm.353.2021.09.25.04.25.55; Sat, 25 Sep 2021 04:26:19 -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=WQR4ljxZ; 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 S245152AbhIYLZb (ORCPT + 99 others); Sat, 25 Sep 2021 07:25:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:56398 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244920AbhIYLZP (ORCPT ); Sat, 25 Sep 2021 07:25:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 137D361283; Sat, 25 Sep 2021 11:23:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632569021; bh=pUbkHY0vLhXWzTqeqyikItDOpfddhvNos+1sgTUBTR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WQR4ljxZy+usZPnLesAejIasJivigRp0LS+HuMU22e7S386OBHOLwL+o8RUd5buz6 kguMzkCXimp2hkUSwGli2B2qJEbbZyTGl+AnA3IxA7sWJLTUeZlDap7zeqSr4Br767 ZsNPsfXFopKpTVZcRJNn+PdT1plW+K8YKdsZ9rvxhJSm2S9Oq5+IzENfjP8wwFybFm UCFmt7LvKub5o/ollb3esYSpgq4fuv66Nbp36NTUbQnRrBGNy5++u6hsU0P7SWOEEP ecUDd7szo5zQLBppMR5a4fWQNdDEmtj5gPLgVrqRuU8bGiB0fc/yAL5agDgI2BKkfy iXGWWJeZvDQaw== 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 11/21] mlxsw: core: Register devlink instance last Date: Sat, 25 Sep 2021 14:22:51 +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 Make sure that devlink is open to receive user input when all parameters are initialized. Signed-off-by: Leon Romanovsky --- drivers/net/ethernet/mellanox/mlxsw/core.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c index 9a570fa167b6..9e831e8b607a 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core.c @@ -1973,9 +1973,6 @@ __mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info, if (err) goto err_emad_init; - if (!reload) - devlink_register(devlink); - if (!reload) { err = mlxsw_core_params_register(mlxsw_core); if (err) @@ -2010,10 +2007,10 @@ __mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info, goto err_driver_init; } - devlink_params_publish(devlink); - - if (!reload) + if (!reload) { + devlink_register(devlink); devlink_reload_enable(devlink); + } return 0; @@ -2030,8 +2027,6 @@ __mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info, if (!reload) mlxsw_core_params_unregister(mlxsw_core); err_register_params: - if (!reload) - devlink_unregister(devlink); mlxsw_emad_fini(mlxsw_core); err_emad_init: kfree(mlxsw_core->lag.mapping); @@ -2080,8 +2075,10 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core, { struct devlink *devlink = priv_to_devlink(mlxsw_core); - if (!reload) + if (!reload) { devlink_reload_disable(devlink); + devlink_unregister(devlink); + } if (devlink_is_reload_failed(devlink)) { if (!reload) /* Only the parts that were not de-initialized in the @@ -2092,7 +2089,6 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core, return; } - devlink_params_unpublish(devlink); if (mlxsw_core->driver->fini) mlxsw_core->driver->fini(mlxsw_core); mlxsw_env_fini(mlxsw_core->env); @@ -2101,8 +2097,6 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core, mlxsw_core_health_fini(mlxsw_core); if (!reload) mlxsw_core_params_unregister(mlxsw_core); - if (!reload) - devlink_unregister(devlink); mlxsw_emad_fini(mlxsw_core); kfree(mlxsw_core->lag.mapping); mlxsw_ports_fini(mlxsw_core, reload); @@ -2116,7 +2110,6 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core, reload_fail_deinit: mlxsw_core_params_unregister(mlxsw_core); - devlink_unregister(devlink); devlink_resources_unregister(devlink, NULL); devlink_free(devlink); } -- 2.31.1