Commit db7489e0 authored by Bart Van Assche's avatar Bart Van Assche Committed by Doug Ledford

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: 2b1b5b60 ("IB/core, cma: Nice log-friendly string helpers")
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Cc: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 39bfc271
...@@ -88,7 +88,7 @@ static const char * const cma_events[] = { ...@@ -88,7 +88,7 @@ static const char * const cma_events[] = {
[RDMA_CM_EVENT_TIMEWAIT_EXIT] = "timewait exit", [RDMA_CM_EVENT_TIMEWAIT_EXIT] = "timewait exit",
}; };
const char *rdma_event_msg(enum rdma_cm_event_type event) const char *__attribute_const__ rdma_event_msg(enum rdma_cm_event_type event)
{ {
size_t index = event; size_t index = event;
......
...@@ -73,7 +73,7 @@ static const char * const ib_events[] = { ...@@ -73,7 +73,7 @@ static const char * const ib_events[] = {
[IB_EVENT_GID_CHANGE] = "GID changed", [IB_EVENT_GID_CHANGE] = "GID changed",
}; };
const char *ib_event_msg(enum ib_event_type event) const char *__attribute_const__ ib_event_msg(enum ib_event_type event)
{ {
size_t index = event; size_t index = event;
...@@ -107,7 +107,7 @@ static const char * const wc_statuses[] = { ...@@ -107,7 +107,7 @@ static const char * const wc_statuses[] = {
[IB_WC_GENERAL_ERR] = "general error", [IB_WC_GENERAL_ERR] = "general error",
}; };
const char *ib_wc_status_msg(enum ib_wc_status status) const char *__attribute_const__ ib_wc_status_msg(enum ib_wc_status status)
{ {
size_t index = status; size_t index = status;
......
...@@ -476,7 +476,7 @@ enum ib_event_type { ...@@ -476,7 +476,7 @@ enum ib_event_type {
IB_EVENT_GID_CHANGE, IB_EVENT_GID_CHANGE,
}; };
__attribute_const__ const char *ib_event_msg(enum ib_event_type event); const char *__attribute_const__ ib_event_msg(enum ib_event_type event);
struct ib_event { struct ib_event {
struct ib_device *device; struct ib_device *device;
...@@ -726,7 +726,7 @@ enum ib_wc_status { ...@@ -726,7 +726,7 @@ enum ib_wc_status {
IB_WC_GENERAL_ERR IB_WC_GENERAL_ERR
}; };
__attribute_const__ const char *ib_wc_status_msg(enum ib_wc_status status); const char *__attribute_const__ ib_wc_status_msg(enum ib_wc_status status);
enum ib_wc_opcode { enum ib_wc_opcode {
IB_WC_SEND, IB_WC_SEND,
......
...@@ -62,7 +62,7 @@ enum rdma_cm_event_type { ...@@ -62,7 +62,7 @@ enum rdma_cm_event_type {
RDMA_CM_EVENT_TIMEWAIT_EXIT RDMA_CM_EVENT_TIMEWAIT_EXIT
}; };
__attribute_const__ const char *rdma_event_msg(enum rdma_cm_event_type event); const char *__attribute_const__ rdma_event_msg(enum rdma_cm_event_type event);
enum rdma_port_space { enum rdma_port_space {
RDMA_PS_SDP = 0x0001, RDMA_PS_SDP = 0x0001,
......
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