Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1494388 > unrolled thread

[PATCH] iio: Declare event_attrs field of iio_info structure as const

Started byBhumika Goyal <bhumirks@gmail.com>
First post2016-10-01 12:00 +0200
Last post2016-10-01 13:50 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] iio: Declare event_attrs field of iio_info structure as const Bhumika Goyal <bhumirks@gmail.com> - 2016-10-01 12:00 +0200
    Re: [PATCH] iio: Declare event_attrs field of iio_info structure as  const Jonathan Cameron <jic23@kernel.org> - 2016-10-01 13:10 +0200
      Re: [PATCH] iio: Declare event_attrs field of iio_info structure as const Bhumika Goyal <bhumirks@gmail.com> - 2016-10-01 13:50 +0200

#1494388 — [PATCH] iio: Declare event_attrs field of iio_info structure as const

FromBhumika Goyal <bhumirks@gmail.com>
Date2016-10-01 12:00 +0200
Subject[PATCH] iio: Declare event_attrs field of iio_info structure as const
Message-ID<snpfj-6za-1@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1494391 — Re: [PATCH] iio: Declare event_attrs field of iio_info structure as const

FromJonathan Cameron <jic23@kernel.org>
Date2016-10-01 13:10 +0200
SubjectRe: [PATCH] iio: Declare event_attrs field of iio_info structure as const
Message-ID<snql3-7Ct-9@gated-at.bofh.it>
In reply to#1494388
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,
> 

[toc] | [prev] | [next] | [standalone]


#1494395

FromBhumika Goyal <bhumirks@gmail.com>
Date2016-10-01 13:50 +0200
Message-ID<snqXL-7RK-15@gated-at.bofh.it>
In reply to#1494391
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,
>>
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web