aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@sandisk.com>2015-08-03 13:01:52 -0400
committerDoug Ledford <dledford@redhat.com>2015-10-30 17:57:49 -0400
commitdb7489e07669073970358b6cacf6a9dd8dc9275e (patch)
tree74ff570c9b3e633c4323b1cffa0617e37a090124
parent39bfc271bd687be2c8e396e976c0fb9a97963400 (diff)
IB/core, cma: Make __attribute_const__ declarations sparse-friendly
Move the __attribute_const__ declarations such that sparse understands that these apply to the function itself and not to the return type. This avoids that sparse reports error messages like the following: drivers/infiniband/core/verbs.c:73:12: error: symbol 'ib_event_msg' redeclared with different type (originally declared at include/rdma/ib_verbs.h:470) - different modifiers Fixes: 2b1b5b601230 ("IB/core, cma: Nice log-friendly string helpers") Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Cc: Sagi Grimberg <sagig@mellanox.com> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/core/cma.c2
-rw-r--r--drivers/infiniband/core/verbs.c4
-rw-r--r--include/rdma/ib_verbs.h4
-rw-r--r--include/rdma/rdma_cm.h2
4 files changed, 6 insertions, 6 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 7e93eb1f33eb..944cd90417bc 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -88,7 +88,7 @@ static const char * const cma_events[] = {
88 [RDMA_CM_EVENT_TIMEWAIT_EXIT] = "timewait exit", 88 [RDMA_CM_EVENT_TIMEWAIT_EXIT] = "timewait exit",
89}; 89};
90 90
91const char *rdma_event_msg(enum rdma_cm_event_type event) 91const char *__attribute_const__ rdma_event_msg(enum rdma_cm_event_type event)
92{ 92{
93 size_t index = event; 93 size_t index = event;
94 94
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index e2e53f9d7a22..043a60ee6836 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -73,7 +73,7 @@ static const char * const ib_events[] = {
73 [IB_EVENT_GID_CHANGE] = "GID changed", 73 [IB_EVENT_GID_CHANGE] = "GID changed",
74}; 74};
75 75
76const char *ib_event_msg(enum ib_event_type event) 76const char *__attribute_const__ ib_event_msg(enum ib_event_type event)
77{ 77{
78 size_t index = event; 78 size_t index = event;
79 79
@@ -107,7 +107,7 @@ static const char * const wc_statuses[] = {
107 [IB_WC_GENERAL_ERR] = "general error", 107 [IB_WC_GENERAL_ERR] = "general error",
108}; 108};
109 109
110const char *ib_wc_status_msg(enum ib_wc_status status) 110const char *__attribute_const__ ib_wc_status_msg(enum ib_wc_status status)
111{ 111{
112 size_t index = status; 112 size_t index = status;
113 113
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 324e9bf8e66c..9a68a19532ba 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -476,7 +476,7 @@ enum ib_event_type {
476 IB_EVENT_GID_CHANGE, 476 IB_EVENT_GID_CHANGE,
477}; 477};
478 478
479__attribute_const__ const char *ib_event_msg(enum ib_event_type event); 479const char *__attribute_const__ ib_event_msg(enum ib_event_type event);
480 480
481struct ib_event { 481struct ib_event {
482 struct ib_device *device; 482 struct ib_device *device;
@@ -726,7 +726,7 @@ enum ib_wc_status {
726 IB_WC_GENERAL_ERR 726 IB_WC_GENERAL_ERR
727}; 727};
728 728
729__attribute_const__ const char *ib_wc_status_msg(enum ib_wc_status status); 729const char *__attribute_const__ ib_wc_status_msg(enum ib_wc_status status);
730 730
731enum ib_wc_opcode { 731enum ib_wc_opcode {
732 IB_WC_SEND, 732 IB_WC_SEND,
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h
index 463ec0ccbe51..afe44fde72a5 100644
--- a/include/rdma/rdma_cm.h
+++ b/include/rdma/rdma_cm.h
@@ -62,7 +62,7 @@ enum rdma_cm_event_type {
62 RDMA_CM_EVENT_TIMEWAIT_EXIT 62 RDMA_CM_EVENT_TIMEWAIT_EXIT
63}; 63};
64 64
65__attribute_const__ const char *rdma_event_msg(enum rdma_cm_event_type event); 65const char *__attribute_const__ rdma_event_msg(enum rdma_cm_event_type event);
66 66
67enum rdma_port_space { 67enum rdma_port_space {
68 RDMA_PS_SDP = 0x0001, 68 RDMA_PS_SDP = 0x0001,