From patchwork Wed Mar 15 22:12:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 9626805 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 A9FD6604A9 for ; Wed, 15 Mar 2017 22:12:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BAFF2823D for ; Wed, 15 Mar 2017 22:12:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90C9128356; Wed, 15 Mar 2017 22:12:23 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, 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 3AB2A284CB for ; Wed, 15 Mar 2017 22:12:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753214AbdCOWMV (ORCPT ); Wed, 15 Mar 2017 18:12:21 -0400 Received: from quartz.orcorp.ca ([184.70.90.242]:41437 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753117AbdCOWMS (ORCPT ); Wed, 15 Mar 2017 18:12:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=obsidianresearch.com; s=rsa1; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=UYWJCorwfBdH3Ojxk/ajrWx4NBpmpYf98CO/YhTwtp8=; b=ItY9G+mRZDWQEOmLH4NIoEhhs16KK8jUGvRbMW0EK4PRm4WG/5st3bu7Lsp6xNJH4DAL2IrbJ9RbBJB/h9sdrvRUIZdX062eTqsEfrtK64xSsi6TD3ezgC4I5rYzuMQN/LalijQN5GQ7I1XmuQ3k9hK4/p1Ngsq6PzLfxDB9wO4=; Received: from [10.0.0.156] (helo=jggl.edm.orcorp.ca) by quartz.orcorp.ca with esmtps (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1coH9T-0004qS-0N; Wed, 15 Mar 2017 16:12:15 -0600 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Yishai Hadas Subject: [PATCH rdma-core 6/6] verbs: Consistently apply __attribute_const Date: Wed, 15 Mar 2017 16:12:07 -0600 Message-Id: <1489615927-12117-7-git-send-email-jgunthorpe@obsidianresearch.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489615927-12117-1-git-send-email-jgunthorpe@obsidianresearch.com> References: <1489615927-12117-1-git-send-email-jgunthorpe@obsidianresearch.com> X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.156 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 Put it on the prototype and the declaration. Sparse complains if the attribute is not in exactly the same spot, so always put it in the usual place for declarations. Signed-off-by: Jason Gunthorpe --- libibverbs/verbs.c | 8 ++++---- libibverbs/verbs.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libibverbs/verbs.c b/libibverbs/verbs.c index 6a5b2a52da3c5b..8f7cb43a220b86 100644 --- a/libibverbs/verbs.c +++ b/libibverbs/verbs.c @@ -51,7 +51,7 @@ #include "neigh.h" #endif -int ibv_rate_to_mult(enum ibv_rate rate) +int __attribute__((const)) ibv_rate_to_mult(enum ibv_rate rate) { switch (rate) { case IBV_RATE_2_5_GBPS: return 1; @@ -67,7 +67,7 @@ int ibv_rate_to_mult(enum ibv_rate rate) } } -enum ibv_rate mult_to_ibv_rate(int mult) +enum ibv_rate __attribute__((const)) mult_to_ibv_rate(int mult) { switch (mult) { case 1: return IBV_RATE_2_5_GBPS; @@ -83,7 +83,7 @@ enum ibv_rate mult_to_ibv_rate(int mult) } } -int ibv_rate_to_mbps(enum ibv_rate rate) +int __attribute__((const)) ibv_rate_to_mbps(enum ibv_rate rate) { switch (rate) { case IBV_RATE_2_5_GBPS: return 2500; @@ -107,7 +107,7 @@ int ibv_rate_to_mbps(enum ibv_rate rate) } } -enum ibv_rate mbps_to_ibv_rate(int mbps) +enum ibv_rate __attribute__((const)) mbps_to_ibv_rate(int mbps) { switch (mbps) { case 2500: return IBV_RATE_2_5_GBPS; diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 25f4ededdb6d63..ee0fac42e68a77 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -584,26 +584,26 @@ enum ibv_rate { * converted to 2, since 5 Gbit/sec is 2 * 2.5 Gbit/sec. * @rate: rate to convert. */ -int ibv_rate_to_mult(enum ibv_rate rate) __attribute_const; +int __attribute_const ibv_rate_to_mult(enum ibv_rate rate); /** * mult_to_ibv_rate - Convert a multiple of 2.5 Gbit/sec to an IB rate enum. * @mult: multiple to convert. */ -enum ibv_rate mult_to_ibv_rate(int mult) __attribute_const; +enum ibv_rate __attribute_const mult_to_ibv_rate(int mult); /** * ibv_rate_to_mbps - Convert the IB rate enum to Mbit/sec. * For example, IBV_RATE_5_GBPS will return the value 5000. * @rate: rate to convert. */ -int ibv_rate_to_mbps(enum ibv_rate rate) __attribute_const; +int __attribute_const ibv_rate_to_mbps(enum ibv_rate rate); /** * mbps_to_ibv_rate - Convert a Mbit/sec value to an IB rate enum. * @mbps: value to convert. */ -enum ibv_rate mbps_to_ibv_rate(int mbps) __attribute_const; +enum ibv_rate __attribute_const mbps_to_ibv_rate(int mbps) __attribute_const; struct ibv_ah_attr { struct ibv_global_route grh;