Thread (16 messages) 16 messages, 6 authors, 2016-09-12

[PATCH 09/26] i40iw: constify local structures

From: Julia Lawall <hidden>
Date: 2016-09-11 13:35:21
Also in: kernel-janitors, lkml
Subsystem: infiniband subsystem, the rest · Maintainers: Jason Gunthorpe, Leon Romanovsky, Linus Torvalds

For structure types defined in the same file or local header files, find
top-level static structure declarations that have the following
properties:
1. Never reassigned.
2. Address never taken
3. Not passed to a top-level macro call
4. No pointer or array-typed field passed to a function or stored in a
variable.
Declare structures having all of these properties as const.

Done using Coccinelle.
Based on a suggestion by Joe Perches [off-list ref].

Signed-off-by: Julia Lawall <redacted>

---
The semantic patch seems too long for a commit log, but is in the cover
letter.

 drivers/infiniband/hw/i40iw/i40iw_uk.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/i40iw/i40iw_uk.c b/drivers/infiniband/hw/i40iw/i40iw_uk.c
index 4d28c3c..eb94c03 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_uk.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_uk.c
@@ -918,7 +918,7 @@ enum i40iw_status_code i40iw_get_wqe_shift(u32 wqdepth, u32 sge, u32 inline_data
 	return 0;
 }
 
-static struct i40iw_qp_uk_ops iw_qp_uk_ops = {
+static const struct i40iw_qp_uk_ops iw_qp_uk_ops = {
 	i40iw_qp_post_wr,
 	i40iw_qp_ring_push_db,
 	i40iw_rdma_write,
@@ -932,14 +932,14 @@ static struct i40iw_qp_uk_ops iw_qp_uk_ops = {
 	i40iw_nop
 };
 
-static struct i40iw_cq_ops iw_cq_ops = {
+static const struct i40iw_cq_ops iw_cq_ops = {
 	i40iw_cq_request_notification,
 	i40iw_cq_poll_completion,
 	i40iw_cq_post_entries,
 	i40iw_clean_cq
 };
 
-static struct i40iw_device_uk_ops iw_device_uk_ops = {
+static const struct i40iw_device_uk_ops iw_device_uk_ops = {
 	i40iw_cq_uk_init,
 	i40iw_qp_uk_init,
 };

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help