linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: Declare event_attrs field of iio_info structure as const
@ 2016-10-01  9:57 Bhumika Goyal
  2016-10-01 11:09 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Bhumika Goyal @ 2016-10-01  9:57 UTC (permalink / raw)
  To: jic23, knaack.h, lars, pmeerw, linux-iio, linux-kernel; +Cc: Bhumika Goyal

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.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 include/linux/iio/iio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index b4a0679..4591d8e 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -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,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: Declare event_attrs field of iio_info structure as const
  2016-10-01  9:57 [PATCH] iio: Declare event_attrs field of iio_info structure as const Bhumika Goyal
@ 2016-10-01 11:09 ` Jonathan Cameron
  2016-10-01 11:41   ` Bhumika Goyal
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2016-10-01 11:09 UTC (permalink / raw)
  To: Bhumika Goyal, knaack.h, lars, pmeerw, linux-iio, linux-kernel

On 01/10/16 10:57, Bhumika Goyal wrote:
> 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.
> 
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
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
> ---
>  include/linux/iio/iio.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
> index b4a0679..4591d8e 100644
> --- a/include/linux/iio/iio.h
> +++ b/include/linux/iio/iio.h
> @@ -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,
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: Declare event_attrs field of iio_info structure as const
  2016-10-01 11:09 ` Jonathan Cameron
@ 2016-10-01 11:41   ` Bhumika Goyal
  0 siblings, 0 replies; 3+ messages in thread
From: Bhumika Goyal @ 2016-10-01 11:41 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: knaack.h, Lars-Peter Clausen, Peter Meerwald-Stadler, linux-iio,
	linux-kernel

On Sat, Oct 1, 2016 at 4:39 PM, Jonathan Cameron <jic23@kernel.org> wrote:
> On 01/10/16 10:57, Bhumika Goyal wrote:
>> 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.
>>
>> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> 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 ;)
>
Yeah sure, I will definitely submit the follow up patches. :D

Thanks,
Bhumika
>
> Jonathan
>> ---
>>  include/linux/iio/iio.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
>> index b4a0679..4591d8e 100644
>> --- a/include/linux/iio/iio.h
>> +++ b/include/linux/iio/iio.h
>> @@ -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,
>>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-01 11:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-01  9:57 [PATCH] iio: Declare event_attrs field of iio_info structure as const Bhumika Goyal
2016-10-01 11:09 ` Jonathan Cameron
2016-10-01 11:41   ` Bhumika Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).