[v3,1/5] meson saradc: move enums declaration before variables declaration

Message ID 20230627224017.1724097-2-gnstark@sberdevices.ru
State New
Headers
Series meson saradc: add iio channels to read channel 7 mux inputs |

Commit Message

George Stark June 27, 2023, 10:37 p.m. UTC
  Move enums declaration before variables declaration.

Signed-off-by: George Stark <GNStark@sberdevices.ru>
---
 drivers/iio/adc/meson_saradc.c | 44 +++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 22 deletions(-)
  

Comments

Jonathan Cameron July 2, 2023, 9:14 a.m. UTC | #1
On Wed, 28 Jun 2023 01:37:14 +0300
George Stark <gnstark@sberdevices.ru> wrote:

> Move enums declaration before variables declaration.
> 
This is fairly harmless, but would be nice to say 'why'.
Is this just for consistency with the rest of the driver or will
it be required after changes later in the patch set?

> Signed-off-by: George Stark <GNStark@sberdevices.ru>
> ---
>  drivers/iio/adc/meson_saradc.c | 44 +++++++++++++++++-----------------
>  1 file changed, 22 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
> index 18937a262af6..af38d95bd504 100644
> --- a/drivers/iio/adc/meson_saradc.c
> +++ b/drivers/iio/adc/meson_saradc.c
> @@ -202,6 +202,28 @@
>  	.datasheet_name = "TEMP_SENSOR",				\
>  }
>  
> +enum meson_sar_adc_avg_mode {
> +	NO_AVERAGING = 0x0,
> +	MEAN_AVERAGING = 0x1,
> +	MEDIAN_AVERAGING = 0x2,
> +};
> +
> +enum meson_sar_adc_num_samples {
> +	ONE_SAMPLE = 0x0,
> +	TWO_SAMPLES = 0x1,
> +	FOUR_SAMPLES = 0x2,
> +	EIGHT_SAMPLES = 0x3,
> +};
> +
> +enum meson_sar_adc_chan7_mux_sel {
> +	CHAN7_MUX_VSS = 0x0,
> +	CHAN7_MUX_VDD_DIV4 = 0x1,
> +	CHAN7_MUX_VDD_DIV2 = 0x2,
> +	CHAN7_MUX_VDD_MUL3_DIV4 = 0x3,
> +	CHAN7_MUX_VDD = 0x4,
> +	CHAN7_MUX_CH7_INPUT = 0x7,
> +};
> +
>  static const struct iio_chan_spec meson_sar_adc_iio_channels[] = {
>  	MESON_SAR_ADC_CHAN(0),
>  	MESON_SAR_ADC_CHAN(1),
> @@ -227,28 +249,6 @@ static const struct iio_chan_spec meson_sar_adc_and_temp_iio_channels[] = {
>  	IIO_CHAN_SOFT_TIMESTAMP(9),
>  };
>  
> -enum meson_sar_adc_avg_mode {
> -	NO_AVERAGING = 0x0,
> -	MEAN_AVERAGING = 0x1,
> -	MEDIAN_AVERAGING = 0x2,
> -};
> -
> -enum meson_sar_adc_num_samples {
> -	ONE_SAMPLE = 0x0,
> -	TWO_SAMPLES = 0x1,
> -	FOUR_SAMPLES = 0x2,
> -	EIGHT_SAMPLES = 0x3,
> -};
> -
> -enum meson_sar_adc_chan7_mux_sel {
> -	CHAN7_MUX_VSS = 0x0,
> -	CHAN7_MUX_VDD_DIV4 = 0x1,
> -	CHAN7_MUX_VDD_DIV2 = 0x2,
> -	CHAN7_MUX_VDD_MUL3_DIV4 = 0x3,
> -	CHAN7_MUX_VDD = 0x4,
> -	CHAN7_MUX_CH7_INPUT = 0x7,
> -};
> -
>  struct meson_sar_adc_param {
>  	bool					has_bl30_integration;
>  	unsigned long				clock_rate;
  
George Stark July 4, 2023, 12:39 a.m. UTC | #2
Hello Jonathan

On 7/2/23 12:14, Jonathan Cameron wrote:
> On Wed, 28 Jun 2023 01:37:14 +0300
> George Stark <gnstark@sberdevices.ru> wrote:
>
>> Move enums declaration before variables declaration.
>>
> This is fairly harmless, but would be nice to say 'why'.
> Is this just for consistency with the rest of the driver or will
> it be required after changes later in the patch set?
Both refactoring patches 1/5 and 2/5 are required for the latter changes 
in this patch-set.
Ack for extending the commit message.

>
>> Signed-off-by: George Stark <GNStark@sberdevices.ru>
>> ---
>>   drivers/iio/adc/meson_saradc.c | 44 +++++++++++++++++-----------------
>>   1 file changed, 22 insertions(+), 22 deletions(-)
>>
>> diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
>> index 18937a262af6..af38d95bd504 100644
>> --- a/drivers/iio/adc/meson_saradc.c
>> +++ b/drivers/iio/adc/meson_saradc.c
>> @@ -202,6 +202,28 @@
>>   	.datasheet_name = "TEMP_SENSOR",				\
>>   }
>>   
>> +enum meson_sar_adc_avg_mode {
>> +	NO_AVERAGING = 0x0,
>> +	MEAN_AVERAGING = 0x1,
>> +	MEDIAN_AVERAGING = 0x2,
>> +};
>> +
>> +enum meson_sar_adc_num_samples {
>> +	ONE_SAMPLE = 0x0,
>> +	TWO_SAMPLES = 0x1,
>> +	FOUR_SAMPLES = 0x2,
>> +	EIGHT_SAMPLES = 0x3,
>> +};
>> +
>> +enum meson_sar_adc_chan7_mux_sel {
>> +	CHAN7_MUX_VSS = 0x0,
>> +	CHAN7_MUX_VDD_DIV4 = 0x1,
>> +	CHAN7_MUX_VDD_DIV2 = 0x2,
>> +	CHAN7_MUX_VDD_MUL3_DIV4 = 0x3,
>> +	CHAN7_MUX_VDD = 0x4,
>> +	CHAN7_MUX_CH7_INPUT = 0x7,
>> +};
>> +
>>   static const struct iio_chan_spec meson_sar_adc_iio_channels[] = {
>>   	MESON_SAR_ADC_CHAN(0),
>>   	MESON_SAR_ADC_CHAN(1),
>> @@ -227,28 +249,6 @@ static const struct iio_chan_spec meson_sar_adc_and_temp_iio_channels[] = {
>>   	IIO_CHAN_SOFT_TIMESTAMP(9),
>>   };
>>   
>> -enum meson_sar_adc_avg_mode {
>> -	NO_AVERAGING = 0x0,
>> -	MEAN_AVERAGING = 0x1,
>> -	MEDIAN_AVERAGING = 0x2,
>> -};
>> -
>> -enum meson_sar_adc_num_samples {
>> -	ONE_SAMPLE = 0x0,
>> -	TWO_SAMPLES = 0x1,
>> -	FOUR_SAMPLES = 0x2,
>> -	EIGHT_SAMPLES = 0x3,
>> -};
>> -
>> -enum meson_sar_adc_chan7_mux_sel {
>> -	CHAN7_MUX_VSS = 0x0,
>> -	CHAN7_MUX_VDD_DIV4 = 0x1,
>> -	CHAN7_MUX_VDD_DIV2 = 0x2,
>> -	CHAN7_MUX_VDD_MUL3_DIV4 = 0x3,
>> -	CHAN7_MUX_VDD = 0x4,
>> -	CHAN7_MUX_CH7_INPUT = 0x7,
>> -};
>> -
>>   struct meson_sar_adc_param {
>>   	bool					has_bl30_integration;
>>   	unsigned long				clock_rate;
>
> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic
  

Patch

diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index 18937a262af6..af38d95bd504 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -202,6 +202,28 @@ 
 	.datasheet_name = "TEMP_SENSOR",				\
 }
 
+enum meson_sar_adc_avg_mode {
+	NO_AVERAGING = 0x0,
+	MEAN_AVERAGING = 0x1,
+	MEDIAN_AVERAGING = 0x2,
+};
+
+enum meson_sar_adc_num_samples {
+	ONE_SAMPLE = 0x0,
+	TWO_SAMPLES = 0x1,
+	FOUR_SAMPLES = 0x2,
+	EIGHT_SAMPLES = 0x3,
+};
+
+enum meson_sar_adc_chan7_mux_sel {
+	CHAN7_MUX_VSS = 0x0,
+	CHAN7_MUX_VDD_DIV4 = 0x1,
+	CHAN7_MUX_VDD_DIV2 = 0x2,
+	CHAN7_MUX_VDD_MUL3_DIV4 = 0x3,
+	CHAN7_MUX_VDD = 0x4,
+	CHAN7_MUX_CH7_INPUT = 0x7,
+};
+
 static const struct iio_chan_spec meson_sar_adc_iio_channels[] = {
 	MESON_SAR_ADC_CHAN(0),
 	MESON_SAR_ADC_CHAN(1),
@@ -227,28 +249,6 @@  static const struct iio_chan_spec meson_sar_adc_and_temp_iio_channels[] = {
 	IIO_CHAN_SOFT_TIMESTAMP(9),
 };
 
-enum meson_sar_adc_avg_mode {
-	NO_AVERAGING = 0x0,
-	MEAN_AVERAGING = 0x1,
-	MEDIAN_AVERAGING = 0x2,
-};
-
-enum meson_sar_adc_num_samples {
-	ONE_SAMPLE = 0x0,
-	TWO_SAMPLES = 0x1,
-	FOUR_SAMPLES = 0x2,
-	EIGHT_SAMPLES = 0x3,
-};
-
-enum meson_sar_adc_chan7_mux_sel {
-	CHAN7_MUX_VSS = 0x0,
-	CHAN7_MUX_VDD_DIV4 = 0x1,
-	CHAN7_MUX_VDD_DIV2 = 0x2,
-	CHAN7_MUX_VDD_MUL3_DIV4 = 0x3,
-	CHAN7_MUX_VDD = 0x4,
-	CHAN7_MUX_CH7_INPUT = 0x7,
-};
-
 struct meson_sar_adc_param {
 	bool					has_bl30_integration;
 	unsigned long				clock_rate;