* [PATCH] qlogic: netxen: constify bin_attribute structures
@ 2017-02-21 18:47 Bhumika Goyal
2017-02-22 20:40 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Bhumika Goyal @ 2017-02-21 18:47 UTC (permalink / raw)
To: julia.lawall, rahul.verma, manish.chopra, Dept-GELinuxNICDev,
netdev, linux-kernel
Cc: Bhumika Goyal
Declare bin_attribute structures as const as they are only passed as an
arguments to the functions device_remove_bin_file and
device_create_bin_file. These function arguments are of type const, so
bin_attribute structures having this property can be made const too.
Done using Coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct bin_attribute i@p = {...};
@ok1@
identifier r1.i;
position p,p1;
@@
(
device_remove_bin_file(...,&i@p)
|
device_create_bin_file(..., &i@p1)
)
@bad@
position p!={r1.p,ok1.p,ok1.p1};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct bin_attribute i;
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 561fb94..ee5376e 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -3007,14 +3007,14 @@ static ssize_t netxen_sysfs_write_mem(struct file *filp, struct kobject *kobj,
}
-static struct bin_attribute bin_attr_crb = {
+static const struct bin_attribute bin_attr_crb = {
.attr = {.name = "crb", .mode = (S_IRUGO | S_IWUSR)},
.size = 0,
.read = netxen_sysfs_read_crb,
.write = netxen_sysfs_write_crb,
};
-static struct bin_attribute bin_attr_mem = {
+static const struct bin_attribute bin_attr_mem = {
.attr = {.name = "mem", .mode = (S_IRUGO | S_IWUSR)},
.size = 0,
.read = netxen_sysfs_read_mem,
@@ -3143,7 +3143,7 @@ static ssize_t netxen_sysfs_write_mem(struct file *filp, struct kobject *kobj,
}
-static struct bin_attribute bin_attr_dimm = {
+static const struct bin_attribute bin_attr_dimm = {
.attr = { .name = "dimm", .mode = (S_IRUGO | S_IWUSR) },
.size = sizeof(struct netxen_dimm_cfg),
.read = netxen_sysfs_read_dimm,
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] qlogic: netxen: constify bin_attribute structures
2017-02-21 18:47 [PATCH] qlogic: netxen: constify bin_attribute structures Bhumika Goyal
@ 2017-02-22 20:40 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-02-22 20:40 UTC (permalink / raw)
To: bhumirks
Cc: julia.lawall, rahul.verma, manish.chopra, Dept-GELinuxNICDev,
netdev, linux-kernel
From: Bhumika Goyal <bhumirks@gmail.com>
Date: Wed, 22 Feb 2017 00:17:48 +0530
> Declare bin_attribute structures as const as they are only passed as an
> arguments to the functions device_remove_bin_file and
> device_create_bin_file. These function arguments are of type const, so
> bin_attribute structures having this property can be made const too.
> Done using Coccinelle:
...
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Also applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-22 20:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-21 18:47 [PATCH] qlogic: netxen: constify bin_attribute structures Bhumika Goyal
2017-02-22 20:40 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).