From patchwork Mon Jul 2 17:28:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10502141 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1339B6028F for ; Mon, 2 Jul 2018 17:28:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE7D428E80 for ; Mon, 2 Jul 2018 17:28:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC5AD28E76; Mon, 2 Jul 2018 17:28:24 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 7DB2428E97 for ; Mon, 2 Jul 2018 17:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752646AbeGBR2X (ORCPT ); Mon, 2 Jul 2018 13:28:23 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:28450 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752254AbeGBR2X (ORCPT ); Mon, 2 Jul 2018 13:28:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1530552587; x=1562088587; h=from:to:cc:subject:date:message-id; bh=tL/ueXw1qZ5CiFO2a2FDfuHMyUAYkDnR4tYsN49GuKo=; b=iygFmw00ZZ1FU2l2NDsu1/PbjaI3oMSR/VczrLB9/HQct/NXdPFDe5vx I+r5JwfB9lLRZRIgE6Wc+bFoWvYWs+T2t2IyuExWS86lGodQ7NOI2nMbN BvVDaWuMLSNF48A33FCXkGMUbFkWilvz7giKGkJfh3qILq6dzBDaxWYkJ AFRmoL171opH151tEuKWxSx6UMuvRFzqmTsljZpP8p7ETqJ1z+vagC2vr jZe2GdbWGL7dZJpAanxQRFd2U1UX0ob1ZBgm++ariZ3ETEb9UL760xFnO udkUXrZUBzQmOaGvpZAYEMNRkFOuEwKdVi4WB4ZKYGEZgPdTM/T9jk1rC g==; X-IronPort-AV: E=Sophos;i="5.51,299,1526313600"; d="scan'208";a="179871841" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Jul 2018 01:29:47 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 02 Jul 2018 10:17:28 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip01.wdc.com with ESMTP; 02 Jul 2018 10:28:23 -0700 From: Bart Van Assche To: Jason Gunthorpe Cc: Doug Ledford , linux-rdma@vger.kernel.org, Bart Van Assche , Matan Barak , Leon Romanovsky Subject: [PATCH] RDMA/core: Fix a violation of the C standard Date: Mon, 2 Jul 2018 10:28:22 -0700 Message-Id: <20180702172822.27827-1-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.18.0 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 This patch avoids that sparse reports the following: drivers/infiniband/core/uverbs_std_types_cq.c:206:1: error: directive in argument list drivers/infiniband/core/uverbs_std_types_cq.c:209:1: error: directive in argument list Additionally, this patch also avoids that sparse warns about defined but not used functions with CONFIG_INFINIBAND_EXP_LEGACY_VERBS_NEW_UAPI=n. Fixes: 185899ee8d00 ("IB/uverbs: Enable ioctl() uAPI by default for new verbs") Signed-off-by: Bart Van Assche Cc: Matan Barak Cc: Leon Romanovsky --- drivers/infiniband/core/uverbs_std_types_cq.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/uverbs_std_types_cq.c b/drivers/infiniband/core/uverbs_std_types_cq.c index 3d293d01afea..3fc1838d6cb1 100644 --- a/drivers/infiniband/core/uverbs_std_types_cq.c +++ b/drivers/infiniband/core/uverbs_std_types_cq.c @@ -53,6 +53,7 @@ static int uverbs_free_cq(struct ib_uobject *uobject, return ret; } +#if IS_ENABLED(CONFIG_INFINIBAND_EXP_LEGACY_VERBS_NEW_UAPI) static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(struct ib_device *ib_dev, struct ib_uverbs_file *file, struct uverbs_attr_bundle *attrs) @@ -199,13 +200,18 @@ static DECLARE_UVERBS_NAMED_METHOD(UVERBS_METHOD_CQ_DESTROY, &UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_DESTROY_CQ_RESP, UVERBS_ATTR_TYPE(struct ib_uverbs_destroy_cq_resp), UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY))); +#endif +#if IS_ENABLED(CONFIG_INFINIBAND_EXP_LEGACY_VERBS_NEW_UAPI) DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_CQ, &UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_ucq_object), 0, uverbs_free_cq), -#if IS_ENABLED(CONFIG_INFINIBAND_EXP_LEGACY_VERBS_NEW_UAPI) &UVERBS_METHOD(UVERBS_METHOD_CQ_CREATE), &UVERBS_METHOD(UVERBS_METHOD_CQ_DESTROY) -#endif ); - +#else +DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_CQ, + &UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_ucq_object), 0, + uverbs_free_cq), + ); +#endif