Skip to content

Commit 0ccea22

Browse files
goyalbhumikadavem330
authored andcommitted
qlogic: qlcnic_sysfs: 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 a577ca6 commit 0ccea22

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,56 +1192,56 @@ static struct device_attribute dev_attr_beacon = {
11921192
.store = qlcnic_store_beacon,
11931193
};
11941194

1195-
static struct bin_attribute bin_attr_crb = {
1195+
static const struct bin_attribute bin_attr_crb = {
11961196
.attr = {.name = "crb", .mode = (S_IRUGO | S_IWUSR)},
11971197
.size = 0,
11981198
.read = qlcnic_sysfs_read_crb,
11991199
.write = qlcnic_sysfs_write_crb,
12001200
};
12011201

1202-
static struct bin_attribute bin_attr_mem = {
1202+
static const struct bin_attribute bin_attr_mem = {
12031203
.attr = {.name = "mem", .mode = (S_IRUGO | S_IWUSR)},
12041204
.size = 0,
12051205
.read = qlcnic_sysfs_read_mem,
12061206
.write = qlcnic_sysfs_write_mem,
12071207
};
12081208

1209-
static struct bin_attribute bin_attr_npar_config = {
1209+
static const struct bin_attribute bin_attr_npar_config = {
12101210
.attr = {.name = "npar_config", .mode = (S_IRUGO | S_IWUSR)},
12111211
.size = 0,
12121212
.read = qlcnic_sysfs_read_npar_config,
12131213
.write = qlcnic_sysfs_write_npar_config,
12141214
};
12151215

1216-
static struct bin_attribute bin_attr_pci_config = {
1216+
static const struct bin_attribute bin_attr_pci_config = {
12171217
.attr = {.name = "pci_config", .mode = (S_IRUGO | S_IWUSR)},
12181218
.size = 0,
12191219
.read = qlcnic_sysfs_read_pci_config,
12201220
.write = NULL,
12211221
};
12221222

1223-
static struct bin_attribute bin_attr_port_stats = {
1223+
static const struct bin_attribute bin_attr_port_stats = {
12241224
.attr = {.name = "port_stats", .mode = (S_IRUGO | S_IWUSR)},
12251225
.size = 0,
12261226
.read = qlcnic_sysfs_get_port_stats,
12271227
.write = qlcnic_sysfs_clear_port_stats,
12281228
};
12291229

1230-
static struct bin_attribute bin_attr_esw_stats = {
1230+
static const struct bin_attribute bin_attr_esw_stats = {
12311231
.attr = {.name = "esw_stats", .mode = (S_IRUGO | S_IWUSR)},
12321232
.size = 0,
12331233
.read = qlcnic_sysfs_get_esw_stats,
12341234
.write = qlcnic_sysfs_clear_esw_stats,
12351235
};
12361236

1237-
static struct bin_attribute bin_attr_esw_config = {
1237+
static const struct bin_attribute bin_attr_esw_config = {
12381238
.attr = {.name = "esw_config", .mode = (S_IRUGO | S_IWUSR)},
12391239
.size = 0,
12401240
.read = qlcnic_sysfs_read_esw_config,
12411241
.write = qlcnic_sysfs_write_esw_config,
12421242
};
12431243

1244-
static struct bin_attribute bin_attr_pm_config = {
1244+
static const struct bin_attribute bin_attr_pm_config = {
12451245
.attr = {.name = "pm_config", .mode = (S_IRUGO | S_IWUSR)},
12461246
.size = 0,
12471247
.read = qlcnic_sysfs_read_pm_config,

0 commit comments

Comments
 (0)