From patchwork Mon Nov 5 11:35:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10667875 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 D760D1751 for ; Mon, 5 Nov 2018 11:35:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C852529702 for ; Mon, 5 Nov 2018 11:35:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCF8C29782; Mon, 5 Nov 2018 11:35:53 +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 6CE4129702 for ; Mon, 5 Nov 2018 11:35:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726319AbeKEUzJ (ORCPT ); Mon, 5 Nov 2018 15:55:09 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:35240 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726358AbeKEUzJ (ORCPT ); Mon, 5 Nov 2018 15:55:09 -0500 Received: by mail-wr1-f66.google.com with SMTP id z16-v6so9143785wrv.2 for ; Mon, 05 Nov 2018 03:35:51 -0800 (PST) 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=mvJiT1jArVrQimiWQ+OILN3kOm3XuDI2EPxrb145v4w=; b=b+dKtIoCMrRXPuyW1WzBKEu6rdYkEZdzsUz50mGufn+GcJBCCGheECoeklwjrjKNc9 I2qz/qsDeHRJnpd4wNnm3q213LsiFkmn1bJQ0plgdrBCPgQcsNuIOL/7Tkf2YwmaQWlu 9xZo10ZoIb2XXPDvIvkL01cKr2+2Lq8hybhalxM/KOT6yscmC7hJ2xQJPsezeDcpIZi+ VdBLnQ4uH3xNunOfTCnd3Cz39CxKaRgg/uWOiZR6w1L8T0PJv0v5K5Gb7TnZn9eVZg5j SH3qy2ivtRigr9HLFLdlBEakTKcLPbp5DF3a8a+1WNSfpQbWxN9H67LFbUZ/BkKKZUOe l/OQ== 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=mvJiT1jArVrQimiWQ+OILN3kOm3XuDI2EPxrb145v4w=; b=ibNTOgRHeTQ3KnER/x+NEEJfU5J4rCNl7PqgBIF6EtGIKr9EHiUK/AX9UPWlE9ee0B oK0BGMJwoXBaSLjEFSnYCU/n6rhVIQXtAGD9YwIO14BwISGIgcLevYMx8WMFYvL69DAg tB0EUjBmDnQsTcrDGGTVixJvvtVfMH31VCB9MfGjnkf9hslEFbytYheW+CS/yYdLQvCT vUvevNnurySFrrZKXagJk2Nl93IRMm+kAFmq+ufHMjvJe9BYd7pfqgbehHF8mQwQQxSy muLe3qoANw+ijuVsUbv0p5pHb8SS0E63KIlAzZLs5YTy921j4wfjtOlGa/JDGVf7g9d0 Im1A== X-Gm-Message-State: AGRZ1gLRynsB/GUn4NrSwmdvKFAO3JpW2Ez5YXY7EthrvuvuJRYW++Oq QuwaZoWFwD/7fLZjVvrsMlk= X-Google-Smtp-Source: AJdET5drkS6x76UDEUMhBXMIo4a1P59+r5F7D8MZbOblAVs9TTxiintEDyDXSBzzKpWuvGhPWP3Epg== X-Received: by 2002:a5d:4609:: with SMTP id t9-v6mr20445803wrq.198.1541417750640; Mon, 05 Nov 2018 03:35:50 -0800 (PST) Received: from kheib-workstation.redhat.com ([192.116.94.216]) by smtp.gmail.com with ESMTPSA id z18-v6sm10762147wru.83.2018.11.05.03.35.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 03:35:50 -0800 (PST) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, kamalheib1@gmail.com Subject: [PATCH rdma-next v3 05/20] RDMA/hfi1: Initialize ib_device_ops struct Date: Mon, 5 Nov 2018 13:35:13 +0200 Message-Id: <20181105113528.8317-6-kamalheib1@gmail.com> X-Mailer: git-send-email 2.14.5 In-Reply-To: <20181105113528.8317-1-kamalheib1@gmail.com> References: <20181105113528.8317-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 | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c index 48e11e510358..3a145406bb12 100644 --- a/drivers/infiniband/hw/hfi1/verbs.c +++ b/drivers/infiniband/hw/hfi1/verbs.c @@ -1616,6 +1616,19 @@ 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 = { + /* Device operations */ + .modify_device = modify_device, + .get_dev_fw_str = hfi1_get_dev_fw_str, + /* Port operations */ + .alloc_rdma_netdev = hfi1_vnic_alloc_rn, + /* MAD operations */ + .process_mad = hfi1_process_mad, + /* Stats operations */ + .alloc_hw_stats = alloc_hw_stats, + .get_hw_stats = get_hw_stats, +}; + /** * hfi1_register_ib_device - register our device with the infiniband core * @dd: the device data structure @@ -1659,14 +1672,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));