2017-08-04 06:38:38

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 0/6] 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(-)

--
1.9.1


2017-08-04 06:38:52

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 6/6] misc: ti-st: 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.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/misc/ti-st/st_kim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index e74413f..b77aaca 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -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,
};

--
1.9.1

2017-08-04 06:38:50

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 2/6] misc: apds990x: 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.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/misc/apds990x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c
index 84e5b94..c9f0703 100644
--- a/drivers/misc/apds990x.c
+++ b/drivers/misc/apds990x.c
@@ -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 },
};

--
1.9.1

2017-08-04 06:38:48

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 4/6] misc: isl29020: 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.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/misc/isl29020.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/isl29020.c b/drivers/misc/isl29020.c
index 4a9c50a..15d1749 100644
--- a/drivers/misc/isl29020.c
+++ b/drivers/misc/isl29020.c
@@ -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
};
--
1.9.1

2017-08-04 06:39:33

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 5/6] misc: lis3lv02d: 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.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/misc/lis3lv02d/lis3lv02d.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c
index e389b0b..8d53609 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d.c
@@ -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
};

--
1.9.1

2017-08-04 06:38:47

by Arvind Yadav

[permalink] [raw]
Subject: [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.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/misc/bh1770glc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/bh1770glc.c b/drivers/misc/bh1770glc.c
index 38fcfe2..9c62bf0 100644
--- a/drivers/misc/bh1770glc.c
+++ b/drivers/misc/bh1770glc.c
@@ -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
};

--
1.9.1

2017-08-04 06:40:07

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 1/6] misc: apds9802als: 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.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/misc/apds9802als.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/apds9802als.c b/drivers/misc/apds9802als.c
index c6cc3dc..05ee771 100644
--- a/drivers/misc/apds9802als.c
+++ b/drivers/misc/apds9802als.c
@@ -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
};
--
1.9.1

2017-08-04 09:10:58

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 0/6] constify misc attribute_group structures.

On Fri, Aug 4, 2017 at 8:37 AM, Arvind Yadav <[email protected]> wrote:
> 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