Re: [PATCH v2] staging: iio: ad7280a: Group similar macros into enums

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Why?

What benefit does this provide?

> 
> Signed-off-by: sayli karnik <karniksayli1995@xxxxxxxxx>
> ---
> Changes in v2:
> Corrected the order of both the enums.
> Used enum data type names instead of unsigned int inside struct
> ad7280_platform_data.
> 
>  drivers/staging/iio/adc/ad7280a.h | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7280a.h b/drivers/staging/iio/adc/ad7280a.h
> index ccfb90d..e22694f 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_acq_time {
> +	AD7280A_ACQ_TIME_400ns = 0,
> +	AD7280A_ACQ_TIME_800ns,
> +	AD7280A_ACQ_TIME_1200ns,
> +	AD7280A_ACQ_TIME_1600ns,

Before your change, you instantly knew that the 1600ns value needed to
be 3.  Now I need to count an enum.  Does this seem like a better
change?  Are you _sure_ the compiler sets the values properly?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux