Skip to contentSkip to conversation

constify misc attribute_group structures.

PATCH In review Arvind Yadav 2 participants 8 messages Aug 4, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover constify misc attribute_group structures.

attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const.

Arvind Yadav (6):
[PATCH 1/6] misc: apds9802als: constify attribute_group structures. [PATCH 2/6] misc: apds990x: constify attribute_group structures. [PATCH 3/6] misc: bh1770glc: constify attribute_group structures. [PATCH 4/6] misc: isl29020: constify attribute_group structures. [PATCH 5/6] misc: lis3lv02d: constify attribute_group structures. [PATCH 6/6] misc: ti-st: constify attribute_group structures.

 drivers/misc/apds9802als.c         | 2 +-
 drivers/misc/apds990x.c            | 2 +-
 drivers/misc/bh1770glc.c           | 2 +-
 drivers/misc/isl29020.c            | 2 +-
 drivers/misc/lis3lv02d/lis3lv02d.c | 2 +-
 drivers/misc/ti-st/st_kim.c        | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/6 misc: bh1770glc: constify attribute_group structures.

attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const.

---
 drivers/misc/bh1770glc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/bh1770glc.c +1 -1
index 38fcfe2..9c62bf0 100644
@@ -1175,7 +1175,7 @@ static DEVICE_ATTR(power_state, S_IRUGO | S_IWUSR, bh1770_power_state_show,
 	NULL
 };
 
-static struct attribute_group bh1770_attribute_group = {
+static const struct attribute_group bh1770_attribute_group = {
 	.attrs = sysfs_attrs
 };
 
Signature · 1 line
1.9.1
#4 lore raw

PATCH 4/6 misc: isl29020: constify attribute_group structures.

In reply to Arvind Yadav

attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const.

---
 drivers/misc/isl29020.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/isl29020.c +1 -1
index 4a9c50a..15d1749 100644
@@ -145,7 +145,7 @@ static DEVICE_ATTR(lux0_sensor_range, S_IRUGO | S_IWUSR,
 	NULL
 };
 
-static struct attribute_group m_als_gr = {
+static const struct attribute_group m_als_gr = {
 	.name = "isl29020",
 	.attrs = mid_att_als
 };
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/6 misc: apds990x: constify attribute_group structures.

In reply to Arvind Yadav

attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const.

---
 drivers/misc/apds990x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/apds990x.c +1 -1
index 84e5b94..c9f0703 100644
@@ -1051,7 +1051,7 @@ static ssize_t apds990x_chip_id_show(struct device *dev,
 	NULL
 };
 
-static struct attribute_group apds990x_attribute_group[] = {
+static const struct attribute_group apds990x_attribute_group[] = {
 	{.attrs = sysfs_attrs_ctrl },
 };
 
Signature · 1 line
1.9.1
#6 lore raw

PATCH 6/6 misc: ti-st: constify attribute_group structures.

In reply to Arvind Yadav

attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const.

---
 drivers/misc/ti-st/st_kim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/ti-st/st_kim.c +1 -1
index e74413f..b77aaca 100644
@@ -660,7 +660,7 @@ static ssize_t show_flow_cntrl(struct device *dev,
 	NULL,
 };
 
-static struct attribute_group uim_attr_grp = {
+static const struct attribute_group uim_attr_grp = {
 	.attrs = uim_attrs,
 };
 
Signature · 1 line
1.9.1
#5 lore raw

PATCH 5/6 misc: lis3lv02d: constify attribute_group structures.

In reply to Arvind Yadav

attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const.

---
 drivers/misc/lis3lv02d/lis3lv02d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/lis3lv02d/lis3lv02d.c +1 -1
index e389b0b..8d53609 100644
@@ -856,7 +856,7 @@ static DEVICE_ATTR(rate, S_IRUGO | S_IWUSR, lis3lv02d_rate_show,
 	NULL
 };
 
-static struct attribute_group lis3lv02d_attribute_group = {
+static const struct attribute_group lis3lv02d_attribute_group = {
 	.attrs = lis3lv02d_attributes
 };
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/6 misc: apds9802als: constify attribute_group structures.

In reply to Arvind Yadav

attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const.

---
 drivers/misc/apds9802als.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/apds9802als.c +1 -1
index c6cc3dc..05ee771 100644
@@ -197,7 +197,7 @@ static DEVICE_ATTR(lux0_sensor_range, S_IRUGO | S_IWUSR,
 	NULL
 };
 
-static struct attribute_group m_als_gr = {
+static const struct attribute_group m_als_gr = {
 	.name = "apds9802als",
 	.attrs = mid_att_als
 };
Signature · 1 line
1.9.1
maintainer
#7 lore raw
In reply to Arvind Yadav
Quoted 11 lines · Arvind Yadav

attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const.

Arvind Yadav (6):
[PATCH 1/6] misc: apds9802als: constify attribute_group structures. [PATCH 2/6] misc: apds990x: constify attribute_group structures. [PATCH 3/6] misc: bh1770glc: constify attribute_group structures. [PATCH 4/6] misc: isl29020: constify attribute_group structures. [PATCH 5/6] misc: lis3lv02d: constify attribute_group structures. [PATCH 6/6] misc: ti-st: constify attribute_group structures.

Looks good to me, thanks

Arnd