diff options
author | Bhumika Goyal <bhumirks@gmail.com> | 2017-02-21 13:47:48 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-02-22 15:39:09 -0500 |
commit | ff2924583b7211b062ee5433924256f99011b0d9 (patch) | |
tree | 4a10351e9a0a040ca02b37fa6fbe2d50b873959d | |
parent | 0ccea2210c7ed486c688cd05fd1b674d95ef9894 (diff) |
qlogic: netxen: constify bin_attribute structures
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 6 |
1 files 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 3b5d7cfa2321..827de838389f 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | |||
@@ -3005,14 +3005,14 @@ static ssize_t netxen_sysfs_write_mem(struct file *filp, struct kobject *kobj, | |||
3005 | } | 3005 | } |
3006 | 3006 | ||
3007 | 3007 | ||
3008 | static struct bin_attribute bin_attr_crb = { | 3008 | static const struct bin_attribute bin_attr_crb = { |
3009 | .attr = {.name = "crb", .mode = (S_IRUGO | S_IWUSR)}, | 3009 | .attr = {.name = "crb", .mode = (S_IRUGO | S_IWUSR)}, |
3010 | .size = 0, | 3010 | .size = 0, |
3011 | .read = netxen_sysfs_read_crb, | 3011 | .read = netxen_sysfs_read_crb, |
3012 | .write = netxen_sysfs_write_crb, | 3012 | .write = netxen_sysfs_write_crb, |
3013 | }; | 3013 | }; |
3014 | 3014 | ||
3015 | static struct bin_attribute bin_attr_mem = { | 3015 | static const struct bin_attribute bin_attr_mem = { |
3016 | .attr = {.name = "mem", .mode = (S_IRUGO | S_IWUSR)}, | 3016 | .attr = {.name = "mem", .mode = (S_IRUGO | S_IWUSR)}, |
3017 | .size = 0, | 3017 | .size = 0, |
3018 | .read = netxen_sysfs_read_mem, | 3018 | .read = netxen_sysfs_read_mem, |
@@ -3141,7 +3141,7 @@ out: | |||
3141 | 3141 | ||
3142 | } | 3142 | } |
3143 | 3143 | ||
3144 | static struct bin_attribute bin_attr_dimm = { | 3144 | static const struct bin_attribute bin_attr_dimm = { |
3145 | .attr = { .name = "dimm", .mode = (S_IRUGO | S_IWUSR) }, | 3145 | .attr = { .name = "dimm", .mode = (S_IRUGO | S_IWUSR) }, |
3146 | .size = sizeof(struct netxen_dimm_cfg), | 3146 | .size = sizeof(struct netxen_dimm_cfg), |
3147 | .read = netxen_sysfs_read_dimm, | 3147 | .read = netxen_sysfs_read_dimm, |