Commit 8385fd84 authored by Roland Dreier's avatar Roland Dreier

IB/core: Fix sparse warnings about redeclared functions

Fix a few functions that are declared with __attribute_const__ in the
ib_verbs.h header file but defined without it in verbs.c.  This gets rid
of the following sparse warnings:

    drivers/infiniband/core/verbs.c:51:5: error: symbol 'ib_rate_to_mult' redeclared with different type (originally declared at include/rdma/ib_verbs.h:469) - different modifiers
    drivers/infiniband/core/verbs.c:68:14: error: symbol 'mult_to_ib_rate' redeclared with different type (originally declared at include/rdma/ib_verbs.h:607) - different modifiers
    drivers/infiniband/core/verbs.c:85:5: error: symbol 'ib_rate_to_mbps' redeclared with different type (originally declared at include/rdma/ib_verbs.h:476) - different modifiers
    drivers/infiniband/core/verbs.c:111:1: error: symbol 'rdma_node_get_transport' redeclared with different type (originally declared at include/rdma/ib_verbs.h:84) - different modifiers
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent 5343c00d
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include "core_priv.h" #include "core_priv.h"
int ib_rate_to_mult(enum ib_rate rate) __attribute_const__ int ib_rate_to_mult(enum ib_rate rate)
{ {
switch (rate) { switch (rate) {
case IB_RATE_2_5_GBPS: return 1; case IB_RATE_2_5_GBPS: return 1;
...@@ -65,7 +65,7 @@ int ib_rate_to_mult(enum ib_rate rate) ...@@ -65,7 +65,7 @@ int ib_rate_to_mult(enum ib_rate rate)
} }
EXPORT_SYMBOL(ib_rate_to_mult); EXPORT_SYMBOL(ib_rate_to_mult);
enum ib_rate mult_to_ib_rate(int mult) __attribute_const__ enum ib_rate mult_to_ib_rate(int mult)
{ {
switch (mult) { switch (mult) {
case 1: return IB_RATE_2_5_GBPS; case 1: return IB_RATE_2_5_GBPS;
...@@ -82,7 +82,7 @@ enum ib_rate mult_to_ib_rate(int mult) ...@@ -82,7 +82,7 @@ enum ib_rate mult_to_ib_rate(int mult)
} }
EXPORT_SYMBOL(mult_to_ib_rate); EXPORT_SYMBOL(mult_to_ib_rate);
int ib_rate_to_mbps(enum ib_rate rate) __attribute_const__ int ib_rate_to_mbps(enum ib_rate rate)
{ {
switch (rate) { switch (rate) {
case IB_RATE_2_5_GBPS: return 2500; case IB_RATE_2_5_GBPS: return 2500;
...@@ -107,7 +107,7 @@ int ib_rate_to_mbps(enum ib_rate rate) ...@@ -107,7 +107,7 @@ int ib_rate_to_mbps(enum ib_rate rate)
} }
EXPORT_SYMBOL(ib_rate_to_mbps); EXPORT_SYMBOL(ib_rate_to_mbps);
enum rdma_transport_type __attribute_const__ enum rdma_transport_type
rdma_node_get_transport(enum rdma_node_type node_type) rdma_node_get_transport(enum rdma_node_type node_type)
{ {
switch (node_type) { switch (node_type) {
......
...@@ -80,8 +80,8 @@ enum rdma_transport_type { ...@@ -80,8 +80,8 @@ enum rdma_transport_type {
RDMA_TRANSPORT_USNIC_UDP RDMA_TRANSPORT_USNIC_UDP
}; };
enum rdma_transport_type __attribute_const__ enum rdma_transport_type
rdma_node_get_transport(enum rdma_node_type node_type) __attribute_const__; rdma_node_get_transport(enum rdma_node_type node_type);
enum rdma_link_layer { enum rdma_link_layer {
IB_LINK_LAYER_UNSPECIFIED, IB_LINK_LAYER_UNSPECIFIED,
...@@ -466,14 +466,14 @@ enum ib_rate { ...@@ -466,14 +466,14 @@ enum ib_rate {
* converted to 2, since 5 Gbit/sec is 2 * 2.5 Gbit/sec. * converted to 2, since 5 Gbit/sec is 2 * 2.5 Gbit/sec.
* @rate: rate to convert. * @rate: rate to convert.
*/ */
int ib_rate_to_mult(enum ib_rate rate) __attribute_const__; __attribute_const__ int ib_rate_to_mult(enum ib_rate rate);
/** /**
* ib_rate_to_mbps - Convert the IB rate enum to Mbps. * ib_rate_to_mbps - Convert the IB rate enum to Mbps.
* For example, IB_RATE_2_5_GBPS will be converted to 2500. * For example, IB_RATE_2_5_GBPS will be converted to 2500.
* @rate: rate to convert. * @rate: rate to convert.
*/ */
int ib_rate_to_mbps(enum ib_rate rate) __attribute_const__; __attribute_const__ int ib_rate_to_mbps(enum ib_rate rate);
enum ib_mr_create_flags { enum ib_mr_create_flags {
IB_MR_SIGNATURE_EN = 1, IB_MR_SIGNATURE_EN = 1,
...@@ -604,7 +604,7 @@ struct ib_mr_status { ...@@ -604,7 +604,7 @@ struct ib_mr_status {
* enum. * enum.
* @mult: multiple to convert. * @mult: multiple to convert.
*/ */
enum ib_rate mult_to_ib_rate(int mult) __attribute_const__; __attribute_const__ enum ib_rate mult_to_ib_rate(int mult);
struct ib_ah_attr { struct ib_ah_attr {
struct ib_global_route grh; struct ib_global_route grh;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment