From patchwork Sat Sep 25 11:22:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 1532685 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Ge34eptx; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4HGmkr3lT5z9t1C for ; Sat, 25 Sep 2021 21:24:20 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 4A2AA607D3; Sat, 25 Sep 2021 11:24:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AFAR8PKNQUbC; Sat, 25 Sep 2021 11:24:17 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 687DB6070B; Sat, 25 Sep 2021 11:24:17 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 251431BF869 for ; Sat, 25 Sep 2021 11:24:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 13AB8606D9 for ; Sat, 25 Sep 2021 11:24:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GSRYroK14HAZ for ; Sat, 25 Sep 2021 11:24:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp3.osuosl.org (Postfix) with ESMTPS id 8FDFB606AF for ; Sat, 25 Sep 2021 11:24:15 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 6C0A561350; Sat, 25 Sep 2021 11:24:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632569055; bh=7fuwMn0UcxFbiik3Z+N/XOLwJAq59/miUfWhpOwdqE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ge34eptxt6ik9tM4bBGWV+EhWY2pUsDmBrBnZIJGDR8WqRukI42+ESfMMMV9+gmyk NzOJ5DLBu2o6NL6oi1jrLFHILSXlbaTkjCziDiYsxegSE/Jrp/gGgvJVR7RaEimH2k u2KZhp8p3Q+odnSJGYZYpzbjUOdLrNqJ2GAMUiwsAT61gUQdMMmLpIZkJsjPKLDgja 951E4DCRpAC2brIp9LRFyfkQegtVBAkmpGV+8JNtEYeEpLtKlgfwpF/3fdAikKH6yb 0nLBFwTJ2r2zmbCo8w91OLQqyLpu05TcH/BXTltlVcbcWo+yMP4awblDvVJZGPBPj9 feyG+jP8SLazQ== From: Leon Romanovsky To: "David S . Miller" , Jakub Kicinski Date: Sat, 25 Sep 2021 14:22:58 +0300 Message-Id: <6a63d8f6484a46c9120155082a396b44ce86bd1c.1632565508.git.leonro@nvidia.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Intel-wired-lan] [PATCH net-next v1 18/21] net: wwan: iosm: Move devlink_register to be last devlink command X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Alexandre Belloni , Sergey Ryazanov , Michael Guralnik , oss-drivers@corigine.com, netdev@vger.kernel.org, Jerin Jacob , GR-everest-linux-l2@marvell.com, Subbaraya Sundeep , Ioana Ciornei , Leon Romanovsky , Michael Chan , Linu Cherian , Intel Corporation , Tariq Toukan , Florian Fainelli , Manish Chopra , linux-rdma@vger.kernel.org, linux-staging@lists.linux.dev, Shannon Nelson , intel-wired-lan@lists.osuosl.org, Simon Horman , Vivien Didelot , Sunil Goutham , Ariel Elior , Ido Schimmel , Richard Cochran , Satanand Burla , Felix Manlunas , Claudiu Manoil , Loic Poulain , Jiri Pirko , drivers@pensando.io, linux-omap@vger.kernel.org, Bin Luo , GR-Linux-NIC-Dev@marvell.com, Vadym Kochan , Greg Kroah-Hartman , Vladimir Oltean , linux-kernel@vger.kernel.org, Coiby Xu , UNGLinuxDriver@microchip.com, Taras Chornyi , hariprasad , Jonathan Lemon , M Chetan Kumar , Derek Chickles , Saeed Mahameed , Geetha sowjanya Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Leon Romanovsky This change prevents from users to access device before devlink is fully configured. Indirectly this change fixes the commit mentioned below where devlink_unregister() was prematurely removed. Fixes: db4278c55fa5 ("devlink: Make devlink_register to be void") Signed-off-by: Leon Romanovsky --- drivers/net/wwan/iosm/iosm_ipc_devlink.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/wwan/iosm/iosm_ipc_devlink.c b/drivers/net/wwan/iosm/iosm_ipc_devlink.c index 42dbe7fe663c..6fe56f73011b 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_devlink.c +++ b/drivers/net/wwan/iosm/iosm_ipc_devlink.c @@ -305,7 +305,6 @@ struct iosm_devlink *ipc_devlink_init(struct iosm_imem *ipc_imem) ipc_devlink->devlink_ctx = devlink_ctx; ipc_devlink->pcie = ipc_imem->pcie; ipc_devlink->dev = ipc_imem->dev; - devlink_register(devlink_ctx); rc = devlink_params_register(devlink_ctx, iosm_devlink_params, ARRAY_SIZE(iosm_devlink_params)); @@ -315,7 +314,6 @@ struct iosm_devlink *ipc_devlink_init(struct iosm_imem *ipc_imem) goto param_reg_fail; } - devlink_params_publish(devlink_ctx); ipc_devlink->cd_file_info = list; rc = ipc_devlink_create_region(ipc_devlink); @@ -334,6 +332,7 @@ struct iosm_devlink *ipc_devlink_init(struct iosm_imem *ipc_imem) init_completion(&ipc_devlink->devlink_sio.read_sem); skb_queue_head_init(&ipc_devlink->devlink_sio.rx_list); + devlink_register(devlink_ctx); dev_dbg(ipc_devlink->dev, "iosm devlink register success"); return ipc_devlink; @@ -341,7 +340,6 @@ struct iosm_devlink *ipc_devlink_init(struct iosm_imem *ipc_imem) chnl_get_fail: ipc_devlink_destroy_region(ipc_devlink); region_create_fail: - devlink_params_unpublish(devlink_ctx); devlink_params_unregister(devlink_ctx, iosm_devlink_params, ARRAY_SIZE(iosm_devlink_params)); param_reg_fail: @@ -358,8 +356,8 @@ void ipc_devlink_deinit(struct iosm_devlink *ipc_devlink) { struct devlink *devlink_ctx = ipc_devlink->devlink_ctx; + devlink_unregister(devlink_ctx); ipc_devlink_destroy_region(ipc_devlink); - devlink_params_unpublish(devlink_ctx); devlink_params_unregister(devlink_ctx, iosm_devlink_params, ARRAY_SIZE(iosm_devlink_params)); if (ipc_devlink->devlink_sio.devlink_read_pend) { @@ -370,6 +368,5 @@ void ipc_devlink_deinit(struct iosm_devlink *ipc_devlink) skb_queue_purge(&ipc_devlink->devlink_sio.rx_list); ipc_imem_sys_devlink_close(ipc_devlink); - devlink_unregister(devlink_ctx); devlink_free(devlink_ctx); }