Skip to contentSkip to conversation

IB/core, cma: Make __attribute_const__ declarations sparse-friendly

PATCH Applied Bart Van Assche 3 participants 5 messages Aug 3, 2015 – Oct 30, 2015 3 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
Cc Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/[email protected]>
---
 drivers/infiniband/core/cma.c   | 2 +-
 drivers/infiniband/core/verbs.c | 4 ++--
 include/rdma/ib_verbs.h         | 4 ++--
 include/rdma/rdma_cm.h          | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/infiniband/core/cma.c +1 -1
index 143ded2..a7c1788 100644
@@ -84,7 +84,7 @@ static const char * const cma_events[] = {
 	[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;
 
drivers/infiniband/core/verbs.c +2 -2
index 2e5fd89..50fe99f 100644
@@ -70,7 +70,7 @@ static const char * const ib_events[] = {
 	[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;
 
@@ -104,7 +104,7 @@ static const char * const wc_statuses[] = {
 	[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;
 
include/rdma/ib_verbs.h +2 -2
index a2c328b..1d07ba7 100644
@@ -467,7 +467,7 @@ enum ib_event_type {
 	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_device	*device;
@@ -718,7 +718,7 @@ enum ib_wc_status {
 	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 {
 	IB_WC_SEND,
include/rdma/rdma_cm.h +1 -1
index c92522c..31afb5c 100644
@@ -62,7 +62,7 @@ enum rdma_cm_event_type {
 	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 {
 	RDMA_PS_SDP   = 0x0001,
Signature · 6 lines
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by
#2 lore raw
Quoted 9 lines · Bart Van Assche

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")
Cc Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/[email protected]>

Thanks Bart.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Applied
#3 lore raw
In reply to a message not in the archive
Quoted 9 lines · Bart Van Assche

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")
Cc Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/[email protected]>

Thanks, applied.

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 5 lines · Doug Ledford
Quoted 4 lines · Bart Van Assche

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:

Quoted 7 lines
Quoted 5 lines

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")
Cc Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/[email protected]>

Thanks, applied.

(replying to an e-mail of two months ago)

Hi Doug,

On which branch has this patch been applied ? I couldn't find it in your k.o/for-4.4 branch.

Thanks,

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 14 lines · Bart Van Assche
Quoted 13 lines · Doug Ledford
Quoted 11 lines · Bart Van Assche

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")
Cc Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/[email protected]>
Quoted 8 lines
Quoted 1 line

Thanks, applied.

(replying to an e-mail of two months ago)

Hi Doug,

On which branch has this patch been applied ? I couldn't find it in your k.o/for-4.4 branch.

I can't find it myself. Either I said I was taking it and then it got overlooked, or it got lost sometime during a rebase. I've added it to the for-next stack.

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD