iio: Declare event_attrs field of iio_info structure as const
PATCH 1/1 iio: Declare event_attrs field of iio_info structure as const
The event_attrs field of iio_info structure is only initialized once whenever an object of iio_info is created. After that this field is never modified again anywhere in the kernel. So, declare event_attrs field of iio_info as a const struct attribute_group.
Checked for occurences throughout the kernel using grep and coccinelle.
--- include/linux/iio/iio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/iio/iio.h +1 -1
@@ -381,7 +381,7 @@ struct iio_dev;**/ struct iio_info {struct module *driver_module; -struct attribute_group *event_attrs; +const struct attribute_group *event_attrs;const struct attribute_group *attrs; int (*read_raw)(struct iio_dev *indio_dev,
Signature · 1 line
1.9.1
Jonathan Cameron
maintainerQuoted 8 lines · Bhumika Goyal
The
event_attrsfield ofiio_infostructure is only initialized once whenever an object ofiio_infois created. After that this field is never modified again anywhere in the kernel. So, declareevent_attrsfield ofiio_infoas a const structattribute_group.
Checked for occurences throughout the kernel using grep and coccinelle.Signed-off-by Bhumika Goyal <[email protected]>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.
Clearly this becomes more interesting when the follow up patches making ever event_attr group we can constant.
Looking forward to those ;)
Jonathan
Quoted 18 lines
--- include/linux/iio/iio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/iio/iio.h +1
-1@@ -381,7 +381,7 @@ struct iio_dev;**/ struct iio_info {struct module *driver_module; -struct attribute_group *event_attrs; +const struct attribute_group *event_attrs;const struct attribute_group *attrs; int (*read_raw)(struct iio_dev *indio_dev,
Quoted 8 lines · Jonathan Cameron
Quoted 7 lines · Bhumika Goyal
The
event_attrsfield ofiio_infostructure is only initialized once whenever an object ofiio_infois created. After that this field is never modified again anywhere in the kernel. So, declareevent_attrsfield ofiio_infoas a const structattribute_group.
Checked for occurences throughout the kernel using grep and coccinelle.
Quoted 8 lines
Quoted 1 line
Signed-off-by Bhumika Goyal <[email protected]>Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.
Clearly this becomes more interesting when the follow up patches making ever
event_attrgroup we can constant.
Looking forward to those ;)
Yeah sure, I will definitely submit the follow up patches. :D
Thanks,
Bhumika
Quoted 21 lines
Jonathan
Quoted 18 lines
--- include/linux/iio/iio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/iio/iio.h +1
-1@@ -381,7 +381,7 @@ struct iio_dev;**/ struct iio_info {struct module *driver_module; -struct attribute_group *event_attrs; +const struct attribute_group *event_attrs;const struct attribute_group *attrs; int (*read_raw)(struct iio_dev *indio_dev,