* [PATCH 0/2] IB: add const to bin_attribute structures
@ 2017-08-02 10:01 Bhumika Goyal
[not found] ` <1501668090-22662-1-git-send-email-bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Bhumika Goyal @ 2017-08-02 10:01 UTC (permalink / raw)
To: julia.lawall, mike.marciniszyn, dennis.dalessandro, dledford,
sean.hefty, hal.rosenstock, linux-rdma, linux-kernel
Cc: Bhumika Goyal
Declare bin_attribute structures as const.
Done using Coccinelle.
Bhumika Goyal (2):
IB/qib: add const to bin_attribute structures
IB/hfi1: add const to bin_attribute structures
drivers/infiniband/hw/hfi1/sysfs.c | 4 ++--
drivers/infiniband/hw/qib/qib_sysfs.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <1501668090-22662-1-git-send-email-bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* [PATCH 1/2] IB/qib: add const to bin_attribute structures 2017-08-02 10:01 [PATCH 0/2] IB: add const to bin_attribute structures Bhumika Goyal @ 2017-08-02 10:01 ` Bhumika Goyal 2017-08-02 10:01 ` [PATCH 2/2] IB/hfi1: " Bhumika Goyal 2017-08-18 18:08 ` [PATCH 0/2] IB: " Doug Ledford 2 siblings, 0 replies; 5+ messages in thread From: Bhumika Goyal @ 2017-08-02 10:01 UTC (permalink / raw) To: julia.lawall-L2FTfq7BK8M, mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w, dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w, dledford-H+wXaHxf7aLQT0dZR+AlfA, sean.hefty-ral2JQCrhuEAvxtiuMwx3w, hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w, linux-rdma-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA Cc: Bhumika Goyal Add const to bin_attribute structures as they are only passed to the functions sysfs_{remove/create}_bin_file. The arguments passed are of type const, so declare the structures to be const. Done using Coccinelle. @m disable optional_qualifier@ identifier s; position p; @@ static struct bin_attribute s@p={...}; @okay1@ position p; identifier m.s; @@ ( sysfs_create_bin_file(...,&s@p,...) | sysfs_remove_bin_file(...,&s@p,...) ) @bad@ position p!={m.p,okay1.p}; identifier m.s; @@ s@p @change depends on !bad disable optional_qualifier@ identifier m.s; @@ static +const struct bin_attribute s={...}; Signed-off-by: Bhumika Goyal <bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- drivers/infiniband/hw/qib/qib_sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/qib/qib_sysfs.c index fe4cf5e..ca2638d 100644 --- a/drivers/infiniband/hw/qib/qib_sysfs.c +++ b/drivers/infiniband/hw/qib/qib_sysfs.c @@ -247,7 +247,7 @@ static void qib_port_release(struct kobject *kobj) .release = qib_port_release, }; -static struct bin_attribute cc_table_bin_attr = { +static const struct bin_attribute cc_table_bin_attr = { .attr = {.name = "cc_table_bin", .mode = 0444}, .read = read_cc_table_bin, .size = PAGE_SIZE, @@ -286,7 +286,7 @@ static ssize_t read_cc_setting_bin(struct file *filp, struct kobject *kobj, return count; } -static struct bin_attribute cc_setting_bin_attr = { +static const struct bin_attribute cc_setting_bin_attr = { .attr = {.name = "cc_settings_bin", .mode = 0444}, .read = read_cc_setting_bin, .size = PAGE_SIZE, -- 1.9.1 -- 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 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 1/2] IB/qib: add const to bin_attribute structures @ 2017-08-02 10:01 ` Bhumika Goyal 0 siblings, 0 replies; 5+ messages in thread From: Bhumika Goyal @ 2017-08-02 10:01 UTC (permalink / raw) To: julia.lawall, mike.marciniszyn, dennis.dalessandro, dledford, sean.hefty, hal.rosenstock, linux-rdma, linux-kernel Cc: Bhumika Goyal Add const to bin_attribute structures as they are only passed to the functions sysfs_{remove/create}_bin_file. The arguments passed are of type const, so declare the structures to be const. Done using Coccinelle. @m disable optional_qualifier@ identifier s; position p; @@ static struct bin_attribute s@p={...}; @okay1@ position p; identifier m.s; @@ ( sysfs_create_bin_file(...,&s@p,...) | sysfs_remove_bin_file(...,&s@p,...) ) @bad@ position p!={m.p,okay1.p}; identifier m.s; @@ s@p @change depends on !bad disable optional_qualifier@ identifier m.s; @@ static +const struct bin_attribute s={...}; Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> --- drivers/infiniband/hw/qib/qib_sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/qib/qib_sysfs.c index fe4cf5e..ca2638d 100644 --- a/drivers/infiniband/hw/qib/qib_sysfs.c +++ b/drivers/infiniband/hw/qib/qib_sysfs.c @@ -247,7 +247,7 @@ static void qib_port_release(struct kobject *kobj) .release = qib_port_release, }; -static struct bin_attribute cc_table_bin_attr = { +static const struct bin_attribute cc_table_bin_attr = { .attr = {.name = "cc_table_bin", .mode = 0444}, .read = read_cc_table_bin, .size = PAGE_SIZE, @@ -286,7 +286,7 @@ static ssize_t read_cc_setting_bin(struct file *filp, struct kobject *kobj, return count; } -static struct bin_attribute cc_setting_bin_attr = { +static const struct bin_attribute cc_setting_bin_attr = { .attr = {.name = "cc_settings_bin", .mode = 0444}, .read = read_cc_setting_bin, .size = PAGE_SIZE, -- 1.9.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] IB/hfi1: add const to bin_attribute structures 2017-08-02 10:01 [PATCH 0/2] IB: add const to bin_attribute structures Bhumika Goyal [not found] ` <1501668090-22662-1-git-send-email-bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2017-08-02 10:01 ` Bhumika Goyal 2017-08-18 18:08 ` [PATCH 0/2] IB: " Doug Ledford 2 siblings, 0 replies; 5+ messages in thread From: Bhumika Goyal @ 2017-08-02 10:01 UTC (permalink / raw) To: julia.lawall, mike.marciniszyn, dennis.dalessandro, dledford, sean.hefty, hal.rosenstock, linux-rdma, linux-kernel Cc: Bhumika Goyal Add const to bin_attribute structures as they are only passed to the functions sysfs_{remove/create}_bin_file. The arguments passed are of type const, so declare the structures to be const. Done using Coccinelle. @m disable optional_qualifier@ identifier s; position p; @@ static struct bin_attribute s@p={...}; @okay1@ position p; identifier m.s; @@ ( sysfs_create_bin_file(...,&s@p,...) | sysfs_remove_bin_file(...,&s@p,...) ) @bad@ position p!={m.p,okay1.p}; identifier m.s; @@ s@p @change depends on !bad disable optional_qualifier@ identifier m.s; @@ static +const struct bin_attribute s={...}; Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> --- drivers/infiniband/hw/hfi1/sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/sysfs.c b/drivers/infiniband/hw/hfi1/sysfs.c index 2f3bbca..6d2702ef 100644 --- a/drivers/infiniband/hw/hfi1/sysfs.c +++ b/drivers/infiniband/hw/hfi1/sysfs.c @@ -95,7 +95,7 @@ static void port_release(struct kobject *kobj) /* nothing to do since memory is freed by hfi1_free_devdata() */ } -static struct bin_attribute cc_table_bin_attr = { +static const struct bin_attribute cc_table_bin_attr = { .attr = {.name = "cc_table_bin", .mode = 0444}, .read = read_cc_table_bin, .size = PAGE_SIZE, @@ -137,7 +137,7 @@ static ssize_t read_cc_setting_bin(struct file *filp, struct kobject *kobj, return count; } -static struct bin_attribute cc_setting_bin_attr = { +static const struct bin_attribute cc_setting_bin_attr = { .attr = {.name = "cc_settings_bin", .mode = 0444}, .read = read_cc_setting_bin, .size = PAGE_SIZE, -- 1.9.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] IB: add const to bin_attribute structures 2017-08-02 10:01 [PATCH 0/2] IB: add const to bin_attribute structures Bhumika Goyal [not found] ` <1501668090-22662-1-git-send-email-bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2017-08-02 10:01 ` [PATCH 2/2] IB/hfi1: " Bhumika Goyal @ 2017-08-18 18:08 ` Doug Ledford 2 siblings, 0 replies; 5+ messages in thread From: Doug Ledford @ 2017-08-18 18:08 UTC (permalink / raw) To: Bhumika Goyal, julia.lawall, mike.marciniszyn, dennis.dalessandro, sean.hefty, hal.rosenstock, linux-rdma, linux-kernel On Wed, 2017-08-02 at 15:31 +0530, Bhumika Goyal wrote: > Declare bin_attribute structures as const. > Done using Coccinelle. > > Bhumika Goyal (2): > IB/qib: add const to bin_attribute structures > IB/hfi1: add const to bin_attribute structures > > drivers/infiniband/hw/hfi1/sysfs.c | 4 ++-- > drivers/infiniband/hw/qib/qib_sysfs.c | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) Thanks, series applied. -- Doug Ledford <dledford@redhat.com> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-08-18 18:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-02 10:01 [PATCH 0/2] IB: add const to bin_attribute structures Bhumika Goyal
[not found] ` <1501668090-22662-1-git-send-email-bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-02 10:01 ` [PATCH 1/2] IB/qib: " Bhumika Goyal
2017-08-02 10:01 ` Bhumika Goyal
2017-08-02 10:01 ` [PATCH 2/2] IB/hfi1: " Bhumika Goyal
2017-08-18 18:08 ` [PATCH 0/2] IB: " Doug Ledford
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.