Skip to content

Commit d7c1fef

Browse files
rikardfalkebornEnric Balletbo i Serra
authored andcommitted
platform/chrome: Constify static attribute_group structs
The only usage of these is to print their name in a dev_err-message, and to pass their address to sysfs_create_group() and sysfs_remove_group(), both which takes pointers to const. Make them const to allow the compiler to put them in read-only memory. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Link: https://lore.kernel.org/r/20210109001748.58036-1-rikard.falkeborn@gmail.com
1 parent 852405d commit d7c1fef

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/platform/chrome/cros_ec_lightbar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ static struct attribute *__lb_cmds_attrs[] = {
523523
NULL,
524524
};
525525

526-
static struct attribute_group cros_ec_lightbar_attr_group = {
526+
static const struct attribute_group cros_ec_lightbar_attr_group = {
527527
.name = "lightbar",
528528
.attrs = __lb_cmds_attrs,
529529
};

drivers/platform/chrome/cros_ec_sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ static umode_t cros_ec_ctrl_visible(struct kobject *kobj,
329329
return a->mode;
330330
}
331331

332-
static struct attribute_group cros_ec_attr_group = {
332+
static const struct attribute_group cros_ec_attr_group = {
333333
.attrs = __ec_attrs,
334334
.is_visible = cros_ec_ctrl_visible,
335335
};

drivers/platform/chrome/cros_ec_vbc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static struct bin_attribute *cros_ec_vbc_bin_attrs[] = {
101101
NULL
102102
};
103103

104-
static struct attribute_group cros_ec_vbc_attr_group = {
104+
static const struct attribute_group cros_ec_vbc_attr_group = {
105105
.name = "vbc",
106106
.bin_attrs = cros_ec_vbc_bin_attrs,
107107
};

drivers/platform/chrome/wilco_ec/sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ static struct attribute *wilco_dev_attrs[] = {
236236
NULL,
237237
};
238238

239-
static struct attribute_group wilco_dev_attr_group = {
239+
static const struct attribute_group wilco_dev_attr_group = {
240240
.attrs = wilco_dev_attrs,
241241
};
242242

0 commit comments

Comments
 (0)