From patchwork Wed May 4 15:41:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 9016241 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 714EFBF29F for ; Wed, 4 May 2016 15:42:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E6CAF20395 for ; Wed, 4 May 2016 15:42:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C07552025B for ; Wed, 4 May 2016 15:42:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753389AbcEDPmf (ORCPT ); Wed, 4 May 2016 11:42:35 -0400 Received: from mail.kernel.org ([198.145.29.136]:59829 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752032AbcEDPme (ORCPT ); Wed, 4 May 2016 11:42:34 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AAF6020395; Wed, 4 May 2016 15:42:32 +0000 (UTC) Received: from localhost (unknown [193.47.165.251]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 519ED2025B; Wed, 4 May 2016 15:42:31 +0000 (UTC) From: Leon Romanovsky To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, markb@mellanox.com, majd@mellanox.com, matanb@mellanox.com, Leon Romanovsky Subject: [PATCH rdma-next 1/4] IB/netlink: Make ib_netlink a standalone module Date: Wed, 4 May 2016 18:41:55 +0300 Message-Id: <1462376518-6725-2-git-send-email-leon@kernel.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1462376518-6725-1-git-send-email-leon@kernel.org> References: <1462376518-6725-1-git-send-email-leon@kernel.org> X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mark Bloch ib_netlink is initialized by ib_core, which means that any module ib_core depends on (ib_addr for example) can't use ib_netlink. Let's turn ib_netlink to be standalone module, so it could be used by any IB component. Signed-off-by: Mark Bloch Signed-off-by: Leon Romanovsky --- drivers/infiniband/core/Makefile | 6 ++++-- drivers/infiniband/core/device.c | 9 --------- drivers/infiniband/core/netlink.c | 9 ++++++++- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/infiniband/core/Makefile b/drivers/infiniband/core/Makefile index f818538..73a044b 100644 --- a/drivers/infiniband/core/Makefile +++ b/drivers/infiniband/core/Makefile @@ -3,13 +3,13 @@ user_access-$(CONFIG_INFINIBAND_ADDR_TRANS) := rdma_ucm.o obj-$(CONFIG_INFINIBAND) += ib_core.o ib_mad.o ib_sa.o \ ib_cm.o iw_cm.o ib_addr.o \ - $(infiniband-y) + ib_netlink.o $(infiniband-y) obj-$(CONFIG_INFINIBAND_USER_MAD) += ib_umad.o obj-$(CONFIG_INFINIBAND_USER_ACCESS) += ib_uverbs.o ib_ucm.o \ $(user_access-y) ib_core-y := packer.o ud_header.o verbs.o cq.o sysfs.o \ - device.o fmr_pool.o cache.o netlink.o \ + device.o fmr_pool.o cache.o \ roce_gid_mgmt.o ib_core-$(CONFIG_INFINIBAND_USER_MEM) += umem.o ib_core-$(CONFIG_INFINIBAND_ON_DEMAND_PAGING) += umem_odp.o umem_rbtree.o @@ -18,6 +18,8 @@ ib_mad-y := mad.o smi.o agent.o mad_rmpp.o ib_sa-y := sa_query.o multicast.o +ib_netlink-y := netlink.o + ib_cm-y := cm.o iw_cm-y := iwcm.o iwpm_util.o iwpm_msg.o diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 1097984..e482164 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -977,18 +977,10 @@ static int __init ib_core_init(void) goto err_comp; } - ret = ibnl_init(); - if (ret) { - pr_warn("Couldn't init IB netlink interface\n"); - goto err_sysfs; - } - ib_cache_setup(); return 0; -err_sysfs: - class_unregister(&ib_class); err_comp: destroy_workqueue(ib_comp_wq); err: @@ -999,7 +991,6 @@ err: static void __exit ib_core_cleanup(void) { ib_cache_cleanup(); - ibnl_cleanup(); class_unregister(&ib_class); destroy_workqueue(ib_comp_wq); /* Make sure that any pending umem accounting work is done. */ diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c index aa491f7..ff2dcbb 100644 --- a/drivers/infiniband/core/netlink.c +++ b/drivers/infiniband/core/netlink.c @@ -38,6 +38,10 @@ #include #include +MODULE_AUTHOR("Roland Dreier"); +MODULE_DESCRIPTION("RDMA netlink infrastructure"); +MODULE_LICENSE("Dual BSD/GPL"); + struct ibnl_client { struct list_head list; int index; @@ -255,7 +259,7 @@ int __init ibnl_init(void) return 0; } -void ibnl_cleanup(void) +void __exit ibnl_cleanup(void) { struct ibnl_client *cur, *next; @@ -268,3 +272,6 @@ void ibnl_cleanup(void) netlink_kernel_release(nls); } + +module_init(ibnl_init); +module_exit(ibnl_cleanup);