infiniband: hw: hfi1: constify mmu_notifier_ops structure
Subsystems (2)
PATCH 1/1 infiniband: hw: hfi1: constify mmu_notifier_ops structure
Declare the structure mmu_notifier_ops as const as it is only stored in the ops field of a mmu_notifier structure. The ops field is of type const struct mmu_notifier_ops *, so mmu_notifier_ops structures having this property can be declared as const.
Done using coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct mmu_notifier_ops i@p = {...};
@ok1@
identifier r1.i;
position p;
struct mmu_rb_handler handler;
@@
handler.mn.ops=&i@p
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct mmu_notifier_ops i={...};
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct mmu_notifier_ops i;
File size before:
text data bss dec hex filename
3566 72 16 3654 e46drivers/infiniband/hw/hfi1/mmu_rb.o
File size after:
text data bss dec hex filename
3658 0 16 3674 e5adrivers/infiniband/hw/hfi1/mmu_rb.o
--- drivers/infiniband/hw/hfi1/mmu_rb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hfi1/mmu_rb.c +1 -1
@@ -81,7 +81,7 @@ static void do_remove(struct mmu_rb_handler *handler, struct list_head *del_list);static void handle_remove (struct work_struct *work); -static struct mmu_notifier_ops mn_opts = { +static const struct mmu_notifier_ops mn_opts = { .invalidate_page = mmu_notifier_page, .invalidate_range_start = mmu_notifier_range_start, };
Signature · 6 lines
1.9.1 -- 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
Quoted 42 lines · Bhumika Goyal
Declare the structure
mmu_notifier_opsas const as it is only stored in the ops field of ammu_notifierstructure. The ops field is of type const structmmu_notifier_ops*, sommu_notifier_opsstructures having this property can be declared as const.
Done using coccinelle:
@r1 disableoptional_qualifier@
identifier i;
position p;
@@
static structmmu_notifier_opsi@p = {...};@ok1@
identifier r1.i;
position p;
structmmu_rb_handlerhandler;
@@
handler.mn.ops=&i@p@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
structmmu_notifier_opsi={...};@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
structmmu_notifier_opsi;File size before:
text data bss dec hex filename
3566 72 16 3654 e46drivers/infiniband/hw/hfi1/mmu_rb.o
Quoted 6 lines
File size after:
text data bss dec hex filename
3658 0 16 3674 e5adrivers/infiniband/hw/hfi1/mmu_rb.oSigned-off-by Bhumika Goyal <[email protected]>
Quoted 24 lines
--- drivers/infiniband/hw/hfi1/mmu_rb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/infiniband/hw/hfi1/mmu_rb.c +1
-1@@ -81,7 +81,7 @@ static void do_remove(struct mmu_rb_handler *handler, struct list_head *del_list);static void handle_remove (struct work_struct *work); -static struct mmu_notifier_ops mn_opts = { +static const struct mmu_notifier_ops mn_opts = { .invalidate_page = mmu_notifier_page, .invalidate_range_start = mmu_notifier_range_start, };Signature · 6 lines
1.9.1 -- 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
Doug Ledford
AppliedQuoted 4 lines · Bhumika Goyal
Declare the structure
mmu_notifier_opsas const as it is only stored in the ops field of ammu_notifierstructure. The ops field is of type const structmmu_notifier_ops*, sommu_notifier_opsstructures having this property can be declared as const.
Thanks, applied.
Signature · 2 lines
Doug Ledford <[email protected]> GPG Key ID: 0E572FDD