linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: iio: ad7280a: Group similar macros into enums
@ 2017-03-01  5:27 sayli karnik
  2017-03-01  5:54 ` [Outreachy kernel] " Alison Schofield
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: sayli karnik @ 2017-03-01  5:27 UTC (permalink / raw)
  To: outreachy-kernel
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	Hartmut Knaack, Peter Meerwald-Stadler, Greg Kroah-Hartman,
	linux-iio

The patch groups similar macros into enum data types.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
---
 drivers/staging/iio/adc/ad7280a.h | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7280a.h b/drivers/staging/iio/adc/ad7280a.h
index ccfb90d..08e97d4 100644
--- a/drivers/staging/iio/adc/ad7280a.h
+++ b/drivers/staging/iio/adc/ad7280a.h
@@ -13,15 +13,19 @@
  * TODO: struct ad7280_platform_data needs to go into include/linux/iio
  */
 
-#define AD7280A_ACQ_TIME_400ns			0
-#define AD7280A_ACQ_TIME_800ns			1
-#define AD7280A_ACQ_TIME_1200ns			2
-#define AD7280A_ACQ_TIME_1600ns			3
+enum {
+	AD7280A_CONV_AVG_DIS = 0,
+	AD7280A_CONV_AVG_2,
+	AD7280A_CONV_AVG_4,
+	AD7280A_CONV_AVG_8,
+};
 
-#define AD7280A_CONV_AVG_DIS			0
-#define AD7280A_CONV_AVG_2			1
-#define AD7280A_CONV_AVG_4			2
-#define AD7280A_CONV_AVG_8			3
+enum {
+	AD7280A_ACQ_TIME_400ns = 0,
+	AD7280A_ACQ_TIME_800ns,
+	AD7280A_ACQ_TIME_1200ns,
+	AD7280A_ACQ_TIME_1600ns,
+};
 
 #define AD7280A_ALERT_REMOVE_VIN5		BIT(2)
 #define AD7280A_ALERT_REMOVE_VIN4_VIN5		BIT(3)
-- 
2.7.4


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

* Re: [Outreachy kernel] [PATCH] staging: iio: ad7280a: Group similar macros into enums
  2017-03-01  5:27 [PATCH] staging: iio: ad7280a: Group similar macros into enums sayli karnik
@ 2017-03-01  5:54 ` Alison Schofield
  2017-03-01  6:23 ` Julia Lawall
  2017-03-01 16:32 ` Lars-Peter Clausen
  2 siblings, 0 replies; 5+ messages in thread
From: Alison Schofield @ 2017-03-01  5:54 UTC (permalink / raw)
  To: sayli karnik
  Cc: outreachy-kernel, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, Hartmut Knaack, Peter Meerwald-Stadler,
	Greg Kroah-Hartman, linux-iio

On Wed, Mar 01, 2017 at 10:57:12AM +0530, sayli karnik wrote:
> The patch groups similar macros into enum data types.

Hi Sayli,
Thanks for the patch.  It looks like what Lars was requesting.
It tax'ed my brain a tiny bit ;), because the order of the enums
was different than the original order of the #define's.  I don't
know if you should rev for this.  Let's see what reviewers say.
Keep this in mind for future editing though.
alisons

> 
> Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
> ---
>  drivers/staging/iio/adc/ad7280a.h | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7280a.h b/drivers/staging/iio/adc/ad7280a.h
> index ccfb90d..08e97d4 100644
> --- a/drivers/staging/iio/adc/ad7280a.h
> +++ b/drivers/staging/iio/adc/ad7280a.h
> @@ -13,15 +13,19 @@
>   * TODO: struct ad7280_platform_data needs to go into include/linux/iio
>   */
>  
> -#define AD7280A_ACQ_TIME_400ns			0
> -#define AD7280A_ACQ_TIME_800ns			1
> -#define AD7280A_ACQ_TIME_1200ns			2
> -#define AD7280A_ACQ_TIME_1600ns			3
> +enum {
> +	AD7280A_CONV_AVG_DIS = 0,
> +	AD7280A_CONV_AVG_2,
> +	AD7280A_CONV_AVG_4,
> +	AD7280A_CONV_AVG_8,
> +};
>  
> -#define AD7280A_CONV_AVG_DIS			0
> -#define AD7280A_CONV_AVG_2			1
> -#define AD7280A_CONV_AVG_4			2
> -#define AD7280A_CONV_AVG_8			3
> +enum {
> +	AD7280A_ACQ_TIME_400ns = 0,
> +	AD7280A_ACQ_TIME_800ns,
> +	AD7280A_ACQ_TIME_1200ns,
> +	AD7280A_ACQ_TIME_1600ns,
> +};
>  
>  #define AD7280A_ALERT_REMOVE_VIN5		BIT(2)
>  #define AD7280A_ALERT_REMOVE_VIN4_VIN5		BIT(3)
> -- 
> 2.7.4
> 
> -- 
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170301052712.GA19851%40sayli-HP-15-Notebook-PC.
> For more options, visit https://groups.google.com/d/optout.

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

* Re: [Outreachy kernel] [PATCH] staging: iio: ad7280a: Group similar macros into enums
  2017-03-01  5:27 [PATCH] staging: iio: ad7280a: Group similar macros into enums sayli karnik
  2017-03-01  5:54 ` [Outreachy kernel] " Alison Schofield
@ 2017-03-01  6:23 ` Julia Lawall
  2017-03-01  7:25   ` sayli karnik
  2017-03-01 16:32 ` Lars-Peter Clausen
  2 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2017-03-01  6:23 UTC (permalink / raw)
  To: sayli karnik
  Cc: outreachy-kernel, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, Hartmut Knaack, Peter Meerwald-Stadler,
	Greg Kroah-Hartman, linux-iio



On Wed, 1 Mar 2017, sayli karnik wrote:

> The patch groups similar macros into enum data types.

Like Alison said, I wonder why you changed the order.

julia

>
> Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
> ---
>  drivers/staging/iio/adc/ad7280a.h | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7280a.h b/drivers/staging/iio/adc/ad7280a.h
> index ccfb90d..08e97d4 100644
> --- a/drivers/staging/iio/adc/ad7280a.h
> +++ b/drivers/staging/iio/adc/ad7280a.h
> @@ -13,15 +13,19 @@
>   * TODO: struct ad7280_platform_data needs to go into include/linux/iio
>   */
>
> -#define AD7280A_ACQ_TIME_400ns			0
> -#define AD7280A_ACQ_TIME_800ns			1
> -#define AD7280A_ACQ_TIME_1200ns			2
> -#define AD7280A_ACQ_TIME_1600ns			3
> +enum {
> +	AD7280A_CONV_AVG_DIS = 0,
> +	AD7280A_CONV_AVG_2,
> +	AD7280A_CONV_AVG_4,
> +	AD7280A_CONV_AVG_8,
> +};
>
> -#define AD7280A_CONV_AVG_DIS			0
> -#define AD7280A_CONV_AVG_2			1
> -#define AD7280A_CONV_AVG_4			2
> -#define AD7280A_CONV_AVG_8			3
> +enum {
> +	AD7280A_ACQ_TIME_400ns = 0,
> +	AD7280A_ACQ_TIME_800ns,
> +	AD7280A_ACQ_TIME_1200ns,
> +	AD7280A_ACQ_TIME_1600ns,
> +};
>
>  #define AD7280A_ALERT_REMOVE_VIN5		BIT(2)
>  #define AD7280A_ALERT_REMOVE_VIN4_VIN5		BIT(3)
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170301052712.GA19851%40sayli-HP-15-Notebook-PC.
> For more options, visit https://groups.google.com/d/optout.
>

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

* Re: [Outreachy kernel] [PATCH] staging: iio: ad7280a: Group similar macros into enums
  2017-03-01  6:23 ` Julia Lawall
@ 2017-03-01  7:25   ` sayli karnik
  0 siblings, 0 replies; 5+ messages in thread
From: sayli karnik @ 2017-03-01  7:25 UTC (permalink / raw)
  To: Julia Lawall
  Cc: outreachy-kernel, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, Hartmut Knaack, Peter Meerwald-Stadler,
	Greg Kroah-Hartman, linux-iio

On Wed, Mar 1, 2017 at 11:53 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Wed, 1 Mar 2017, sayli karnik wrote:
>
>> The patch groups similar macros into enum data types.
>
> Like Alison said, I wonder why you changed the order.
>
Yes that was a mistake, I'll correct that along with other changes by
the reviewers, if any.

thanks,
sayli

> julia
>
>>
>> Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
>> ---
>>  drivers/staging/iio/adc/ad7280a.h | 20 ++++++++++++--------
>>  1 file changed, 12 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/staging/iio/adc/ad7280a.h b/drivers/staging/iio/adc/ad7280a.h
>> index ccfb90d..08e97d4 100644
>> --- a/drivers/staging/iio/adc/ad7280a.h
>> +++ b/drivers/staging/iio/adc/ad7280a.h
>> @@ -13,15 +13,19 @@
>>   * TODO: struct ad7280_platform_data needs to go into include/linux/iio
>>   */
>>
>> -#define AD7280A_ACQ_TIME_400ns                       0
>> -#define AD7280A_ACQ_TIME_800ns                       1
>> -#define AD7280A_ACQ_TIME_1200ns                      2
>> -#define AD7280A_ACQ_TIME_1600ns                      3
>> +enum {
>> +     AD7280A_CONV_AVG_DIS = 0,
>> +     AD7280A_CONV_AVG_2,
>> +     AD7280A_CONV_AVG_4,
>> +     AD7280A_CONV_AVG_8,
>> +};
>>
>> -#define AD7280A_CONV_AVG_DIS                 0
>> -#define AD7280A_CONV_AVG_2                   1
>> -#define AD7280A_CONV_AVG_4                   2
>> -#define AD7280A_CONV_AVG_8                   3
>> +enum {
>> +     AD7280A_ACQ_TIME_400ns = 0,
>> +     AD7280A_ACQ_TIME_800ns,
>> +     AD7280A_ACQ_TIME_1200ns,
>> +     AD7280A_ACQ_TIME_1600ns,
>> +};
>>
>>  #define AD7280A_ALERT_REMOVE_VIN5            BIT(2)
>>  #define AD7280A_ALERT_REMOVE_VIN4_VIN5               BIT(3)
>> --
>> 2.7.4
>>
>> --
>> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
>> To post to this group, send email to outreachy-kernel@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170301052712.GA19851%40sayli-HP-15-Notebook-PC.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1703010723120.2079%40hadrien.
> For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH] staging: iio: ad7280a: Group similar macros into enums
  2017-03-01  5:27 [PATCH] staging: iio: ad7280a: Group similar macros into enums sayli karnik
  2017-03-01  5:54 ` [Outreachy kernel] " Alison Schofield
  2017-03-01  6:23 ` Julia Lawall
@ 2017-03-01 16:32 ` Lars-Peter Clausen
  2 siblings, 0 replies; 5+ messages in thread
From: Lars-Peter Clausen @ 2017-03-01 16:32 UTC (permalink / raw)
  To: sayli karnik, outreachy-kernel
  Cc: Michael Hennerich, Jonathan Cameron, Hartmut Knaack,
	Peter Meerwald-Stadler, Greg Kroah-Hartman, linux-iio

On 03/01/2017 06:27 AM, sayli karnik wrote:
> The patch groups similar macros into enum data types.
> 
> Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
> ---
>  drivers/staging/iio/adc/ad7280a.h | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7280a.h b/drivers/staging/iio/adc/ad7280a.h
> index ccfb90d..08e97d4 100644
> --- a/drivers/staging/iio/adc/ad7280a.h
> +++ b/drivers/staging/iio/adc/ad7280a.h
> @@ -13,15 +13,19 @@
>   * TODO: struct ad7280_platform_data needs to go into include/linux/iio
>   */
>  
> -#define AD7280A_ACQ_TIME_400ns			0
> -#define AD7280A_ACQ_TIME_800ns			1
> -#define AD7280A_ACQ_TIME_1200ns			2
> -#define AD7280A_ACQ_TIME_1600ns			3
> +enum {

Sorry, I should have been more specific on the previous mail. This should be
named enum, like 'enum ad7280a_conv_avg' and then use the enum type instead
of unsigned int for the field in the platform_data struct. This makes sure
that the there is a clear dependency between the values and the field.

> +	AD7280A_CONV_AVG_DIS = 0,
> +	AD7280A_CONV_AVG_2,
> +	AD7280A_CONV_AVG_4,
> +	AD7280A_CONV_AVG_8,
> +};
>  
> -#define AD7280A_CONV_AVG_DIS			0
> -#define AD7280A_CONV_AVG_2			1
> -#define AD7280A_CONV_AVG_4			2
> -#define AD7280A_CONV_AVG_8			3
> +enum {

Same here.

> +	AD7280A_ACQ_TIME_400ns = 0,
> +	AD7280A_ACQ_TIME_800ns,
> +	AD7280A_ACQ_TIME_1200ns,
> +	AD7280A_ACQ_TIME_1600ns,
> +};
>  
>  #define AD7280A_ALERT_REMOVE_VIN5		BIT(2)
>  #define AD7280A_ALERT_REMOVE_VIN4_VIN5		BIT(3)
> 


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

end of thread, other threads:[~2017-03-01 16:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-01  5:27 [PATCH] staging: iio: ad7280a: Group similar macros into enums sayli karnik
2017-03-01  5:54 ` [Outreachy kernel] " Alison Schofield
2017-03-01  6:23 ` Julia Lawall
2017-03-01  7:25   ` sayli karnik
2017-03-01 16:32 ` Lars-Peter Clausen

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).