From patchwork Sun Oct 21 12:49:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10650765 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E540D1815 for ; Sun, 21 Oct 2018 12:50:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5DFC28765 for ; Sun, 21 Oct 2018 12:50:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA65D2877B; Sun, 21 Oct 2018 12:50:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78D5328779 for ; Sun, 21 Oct 2018 12:50:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727477AbeJUVEd (ORCPT ); Sun, 21 Oct 2018 17:04:33 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:45079 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727603AbeJUVEd (ORCPT ); Sun, 21 Oct 2018 17:04:33 -0400 Received: by mail-wr1-f67.google.com with SMTP id f17-v6so10201692wrs.12 for ; Sun, 21 Oct 2018 05:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=69UErA24yDPi/CXV9C1TDttAqgHhDXRUp4V87iLUVAM=; b=gdFOkfq0O6adLv8zrD7sxkQpf5IA4GCNm759HvweEpUOlS41MbbPnWNtPj1RPJS0La 4Obg8dQAwguet4cp8Yk5fETC0o0LjFt+NXo7vqQJBjEWnbdONPkReQN5eyPw49wBu8CR mBJ7AIBtVVwYYwotaRm+EleAzNNjQtF+RYeCpAL5jmu7amM8LbJhSVC1wNdYZlgQt4Kx ZVaz+WTtnb9XqdGIbjaoGsrs22pd2RXf/KB3k2lM+LuLhSxFyJ/8x9U3Q0MCKf5G756I SFO7uxKgfSfEei/4hJQVZna6EbVl1gOnDjO8AFfJ9RdRZjFwaM/ozZJ1NQBPdwDpcao7 jPeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=69UErA24yDPi/CXV9C1TDttAqgHhDXRUp4V87iLUVAM=; b=bA8FhyZtLpMOyaTBLZJvOFTGhcf0sAoF6a1D0/xcUOXUpjO/ba2orxMsc5dBjT4hQS NP/ifh9MgSxZz4U2QrxNXJKeToPm1Fr7yqk9cNgmamLb4iuqMWUl5NVsklkX0a3T3PkP VVezNZmoczF96VNWNEo3Hp1qKaBpmt2oB82m/XSPlqcRXaf1AjIO+/KbJbglwNbIw3xo YEj7Tvhu61VWFiOqt44lnFRqmoOfvtJlOqrl/ovXzviWvHQoLNA9Megaxwvsgp859OFz iVkiSjPTJrT18H9C4oC9sJw6jXxkua8VEnjzWffKjBwzuTZ3r3ghB5sp3aqz2kzEQB4O I4Cw== X-Gm-Message-State: AGRZ1gLCbKNTF6E4N7WCWCdxtGTnRHdKzSf0nAThCochm22MVuL/RdSm KEA/f1mWMUv8upCLQ7f2PtQ= X-Google-Smtp-Source: AJdET5cU1bgym/BqVGoVn06eOKHAmCEtCFDgPiL2ZEZoMadnhs6ldNXho7Z0XfXZxCNRiJQF4q/OEA== X-Received: by 2002:adf:82f5:: with SMTP id 108-v6mr4267438wrc.131.1540126218786; Sun, 21 Oct 2018 05:50:18 -0700 (PDT) Received: from kheib-workstation.redhat.com ([192.116.94.216]) by smtp.gmail.com with ESMTPSA id v76-v6sm14375380wmd.32.2018.10.21.05.50.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 21 Oct 2018 05:50:18 -0700 (PDT) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v2 05/18] RDMA/hfi1: Initialize ib_device_ops struct Date: Sun, 21 Oct 2018 15:49:40 +0300 Message-Id: <20181021124953.11558-6-kamalheib1@gmail.com> X-Mailer: git-send-email 2.14.5 In-Reply-To: <20181021124953.11558-1-kamalheib1@gmail.com> References: <20181021124953.11558-1-kamalheib1@gmail.com> 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 Initialize ib_device_ops with the supported operations using ib_set_device_ops(). Signed-off-by: Kamal Heib --- drivers/infiniband/hw/hfi1/verbs.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c index 48e11e510358..578f284d2cec 100644 --- a/drivers/infiniband/hw/hfi1/verbs.c +++ b/drivers/infiniband/hw/hfi1/verbs.c @@ -1616,6 +1616,15 @@ static int get_hw_stats(struct ib_device *ibdev, struct rdma_hw_stats *stats, return count; } +static const struct ib_device_ops hfi1_dev_ops = { + .modify_device = modify_device, + .alloc_hw_stats = alloc_hw_stats, + .get_hw_stats = get_hw_stats, + .alloc_rdma_netdev = hfi1_vnic_alloc_rn, + .process_mad = hfi1_process_mad, + .get_dev_fw_str = hfi1_get_dev_fw_str, +}; + /** * hfi1_register_ib_device - register our device with the infiniband core * @dd: the device data structure @@ -1659,14 +1668,8 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) ibdev->owner = THIS_MODULE; ibdev->phys_port_cnt = dd->num_pports; ibdev->dev.parent = &dd->pcidev->dev; - ibdev->modify_device = modify_device; - ibdev->alloc_hw_stats = alloc_hw_stats; - ibdev->get_hw_stats = get_hw_stats; - ibdev->alloc_rdma_netdev = hfi1_vnic_alloc_rn; - - /* keep process mad in the driver */ - ibdev->process_mad = hfi1_process_mad; - ibdev->get_dev_fw_str = hfi1_get_dev_fw_str; + + ib_set_device_ops(ibdev, &hfi1_dev_ops); strlcpy(ibdev->node_desc, init_utsname()->nodename, sizeof(ibdev->node_desc));