Skip to content

Commit ff29245

Browse files
goyalbhumikadavem330
authored andcommitted
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>
1 parent 0ccea22 commit ff29245

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3005,14 +3005,14 @@ static ssize_t netxen_sysfs_write_mem(struct file *filp, struct kobject *kobj,
30053005
}
30063006

30073007

3008-
static struct bin_attribute bin_attr_crb = {
3008+
static const struct bin_attribute bin_attr_crb = {
30093009
.attr = {.name = "crb", .mode = (S_IRUGO | S_IWUSR)},
30103010
.size = 0,
30113011
.read = netxen_sysfs_read_crb,
30123012
.write = netxen_sysfs_write_crb,
30133013
};
30143014

3015-
static struct bin_attribute bin_attr_mem = {
3015+
static const struct bin_attribute bin_attr_mem = {
30163016
.attr = {.name = "mem", .mode = (S_IRUGO | S_IWUSR)},
30173017
.size = 0,
30183018
.read = netxen_sysfs_read_mem,
@@ -3141,7 +3141,7 @@ netxen_sysfs_read_dimm(struct file *filp, struct kobject *kobj,
31413141

31423142
}
31433143

3144-
static struct bin_attribute bin_attr_dimm = {
3144+
static const struct bin_attribute bin_attr_dimm = {
31453145
.attr = { .name = "dimm", .mode = (S_IRUGO | S_IWUSR) },
31463146
.size = sizeof(struct netxen_dimm_cfg),
31473147
.read = netxen_sysfs_read_dimm,

0 commit comments

Comments
 (0)