staging: comedi: ni_mio_common: Code reformat and re-indentation
PATCH 1/1 staging: comedi: ni_mio_common: Code reformat and re-indentation
Resolve general code indentation problems as detected by checkpatch script. Implement code reformat and re-indentation as per coding style to improve readability.
--- .../staging/comedi/drivers/ni_mio_common.c | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-)
drivers/staging/comedi/drivers/ni_mio_common.c +32 -30
@@ -2198,10 +2198,10 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)NISTC_AI_TRIG_START1_SEL (0 );break ;case TRIG_EXT : - ai_trig |=NISTC_AI_TRIG_START1_SEL ( -ni_get_reg_value_roffs (CR_CHAN (cmd->start_arg), - NI_AI_StartTrigger, - &devpriv->routing_tables,1 )); + ai_trig |=NISTC_AI_TRIG_START1_SEL (ni_get_reg_value_roffs ( +CR_CHAN (cmd->start_arg), + NI_AI_StartTrigger, + &devpriv->routing_tables,1 ));if (cmd->start_arg &CR_INVERT ) ai_trig |=NISTC_AI_TRIG_START1_POLARITY ;
@@ -2311,10 +2311,11 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) (cmd->scan_begin_arg & ~CR_EDGE) != (cmd->convert_arg & ~CR_EDGE)) start_stop_select |=NISTC_AI_START_SYNC ; - start_stop_select |=NISTC_AI_START_SEL ( -ni_get_reg_value_roffs (CR_CHAN (cmd->scan_begin_arg), - NI_AI_SampleClock, - &devpriv->routing_tables,1 )); + + start_stop_select |=NISTC_AI_START_SEL (ni_get_reg_value_roffs ( +CR_CHAN (cmd->scan_begin_arg), + NI_AI_SampleClock, + &devpriv->routing_tables,1 ));ni_stc_writew (dev, start_stop_select,NISTC_AI_START_STOP_REG );break ; }
@@ -2342,10 +2343,10 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)ni_stc_writew (dev, mode2,NISTC_AI_MODE2_REG );break ;case TRIG_EXT : - mode1 |=NISTC_AI_MODE1_CONVERT_SRC ( -ni_get_reg_value_roffs (CR_CHAN (cmd->convert_arg), - NI_AI_ConvertClock, - &devpriv->routing_tables,1 )); + mode1 |=NISTC_AI_MODE1_CONVERT_SRC (ni_get_reg_value_roffs ( +CR_CHAN (cmd->convert_arg), + NI_AI_ConvertClock, + &devpriv->routing_tables,1 ));if ((cmd->convert_arg &CR_INVERT ) ==0 ) mode1 |=NISTC_AI_MODE1_CONVERT_POLARITY ;ni_stc_writew (dev, mode1,NISTC_AI_MODE1_REG );
@@ -2969,10 +2970,11 @@ static void ni_ao_cmd_set_trigger(struct comedi_device *dev, trigsel =NISTC_AO_TRIG_START1_EDGE |NISTC_AO_TRIG_START1_SYNC ; }else {/* TRIG_EXT */ - trigsel =NISTC_AO_TRIG_START1_SEL ( -ni_get_reg_value_roffs (CR_CHAN (cmd->start_arg), - NI_AO_StartTrigger, - &devpriv->routing_tables,1 )); + trigsel =NISTC_AO_TRIG_START1_SEL (ni_get_reg_value_roffs ( +CR_CHAN (cmd->start_arg), + NI_AO_StartTrigger, + &devpriv->routing_tables,1 )); +/* 0=active high, 1=active low. see daq-stc 3-24 (p186) */ if (cmd->start_arg &CR_INVERT ) trigsel |=NISTC_AO_TRIG_START1_POLARITY ;
@@ -3079,12 +3081,10 @@ static void ni_ao_cmd_set_update(struct comedi_device *dev,* zero out these bit fields to be set below. Does an ao-reset do this * automatically? */ - devpriv->ao_mode1 &= ~( -NISTC_AO_MODE1_UI_SRC_MASK | -NISTC_AO_MODE1_UI_SRC_POLARITY | -NISTC_AO_MODE1_UPDATE_SRC_MASK | -NISTC_AO_MODE1_UPDATE_SRC_POLARITY - ); + devpriv->ao_mode1 &= ~(NISTC_AO_MODE1_UI_SRC_MASK | +NISTC_AO_MODE1_UI_SRC_POLARITY | +NISTC_AO_MODE1_UPDATE_SRC_MASK | +NISTC_AO_MODE1_UPDATE_SRC_POLARITY );if (cmd->scan_begin_src ==TRIG_TIMER ) {unsigned int trigvar;
@@ -3133,10 +3133,10 @@ static void ni_ao_cmd_set_update(struct comedi_device *dev, }else {/* TRIG_EXT */ /* FIXME: assert scan_begin_arg != 0, ret failure otherwise */ devpriv->ao_cmd2 |=NISTC_AO_CMD2_BC_GATE_ENA ; - devpriv->ao_mode1 |=NISTC_AO_MODE1_UPDATE_SRC ( -ni_get_reg_value (CR_CHAN (cmd->scan_begin_arg), - NI_AO_SampleClock, - &devpriv->routing_tables)); + devpriv->ao_mode1 |=NISTC_AO_MODE1_UPDATE_SRC (ni_get_reg_value ( +CR_CHAN (cmd->scan_begin_arg), + NI_AO_SampleClock, + &devpriv->routing_tables));if (cmd->scan_begin_arg &CR_INVERT ) devpriv->ao_mode1 |=NISTC_AO_MODE1_UPDATE_SRC_POLARITY ; }
@@ -3672,13 +3672,15 @@ static int ni_cdio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)*/ cdo_mode_bits =NI_M_CDO_MODE_FIFO_MODE |NI_M_CDO_MODE_HALT_ON_ERROR | -NI_M_CDO_MODE_SAMPLE_SRC ( -ni_get_reg_value (CR_CHAN (cmd->scan_begin_arg), - NI_DO_SampleClock, - &devpriv->routing_tables)); +NI_M_CDO_MODE_SAMPLE_SRC (ni_get_reg_value ( +CR_CHAN (cmd->scan_begin_arg), + NI_DO_SampleClock, + &devpriv->routing_tables));if (cmd->scan_begin_arg &CR_INVERT ) cdo_mode_bits |=NI_M_CDO_MODE_POLARITY ; +ni_writel (dev, cdo_mode_bits,NI_M_CDO_MODE_REG ); +if (s->io_bits) {ni_writel (dev, s->state,NI_M_CDO_FIFO_DATA_REG );ni_writel (dev,NI_M_CDO_CMD_SW_UPDATE ,NI_M_CDIO_CMD_REG );
Signature · 1 line
2.17.1
Quoted 15 lines · Deepak R Varma
Resolve general code indentation problems as detected by checkpatch script. Implement code reformat and re-indentation as per coding style to improve readability.
Signed-off-by Deepak R Varma <[email protected]>--- .../staging/comedi/drivers/ni_mio_common.c | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-)drivers/staging/comedi/drivers/ni_mio_common.c +0
-0@@ -2198,10 +2198,10 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)NISTC_AI_TRIG_START1_SEL (0 );
drivers/staging/comedi/drivers/ni_mio_common.c static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) · line 2204
Quoted 10 lines
drivers/staging/comedi/drivers/ni_mio_common.c +4
-4break ;case TRIG_EXT : - ai_trig |=NISTC_AI_TRIG_START1_SEL ( -ni_get_reg_value_roffs (CR_CHAN (cmd->start_arg), - NI_AI_StartTrigger, - &devpriv->routing_tables,1 )); + ai_trig |=NISTC_AI_TRIG_START1_SEL (ni_get_reg_value_roffs ( +CR_CHAN (cmd->start_arg), + NI_AI_StartTrigger, + &devpriv->routing_tables,1 ));
These may have been better as they were. At least the two function calls are more visible in the original.
[...]
Quoted 4 lines
drivers/staging/comedi/drivers/ni_mio_common.c +0
-0@@ -3079,12 +3081,10 @@ static void ni_ao_cmd_set_update(struct comedi_device *dev,* zero out these bit fields to be set below. Does an ao-reset do this * automatically? */
drivers/staging/comedi/drivers/ni_mio_common.c static void ni_ao_cmd_set_update(struct comedi_device *dev, · line 3087
Quoted 10 lines
drivers/staging/comedi/drivers/ni_mio_common.c +4
-6- devpriv->ao_mode1 &= ~( -NISTC_AO_MODE1_UI_SRC_MASK | -NISTC_AO_MODE1_UI_SRC_POLARITY | -NISTC_AO_MODE1_UPDATE_SRC_MASK | -NISTC_AO_MODE1_UPDATE_SRC_POLARITY - ); + devpriv->ao_mode1 &= ~(NISTC_AO_MODE1_UI_SRC_MASK | +NISTC_AO_MODE1_UI_SRC_POLARITY | +NISTC_AO_MODE1_UPDATE_SRC_MASK | +NISTC_AO_MODE1_UPDATE_SRC_POLARITY );
This looks like an improveemnt. Are the subsequent NISTCs lines up with the right side of the (? It doesn't look like it, but the +s can change the appearance of the indentation.
Quoted 19 lines
drivers/staging/comedi/drivers/ni_mio_common.c +4
-4if (cmd->scan_begin_src ==TRIG_TIMER ) {unsigned int trigvar;@@ -3133,10 +3133,10 @@ static void ni_ao_cmd_set_update(struct comedi_device *dev, }else {/* TRIG_EXT */ /* FIXME: assert scan_begin_arg != 0, ret failure otherwise */ devpriv->ao_cmd2 |=NISTC_AO_CMD2_BC_GATE_ENA ; - devpriv->ao_mode1 |=NISTC_AO_MODE1_UPDATE_SRC ( -ni_get_reg_value (CR_CHAN (cmd->scan_begin_arg), - NI_AO_SampleClock, - &devpriv->routing_tables)); + devpriv->ao_mode1 |=NISTC_AO_MODE1_UPDATE_SRC (ni_get_reg_value ( +CR_CHAN (cmd->scan_begin_arg), + NI_AO_SampleClock, + &devpriv->routing_tables));if (cmd->scan_begin_arg &CR_INVERT ) devpriv->ao_mode1 |=NISTC_AO_MODE1_UPDATE_SRC_POLARITY ; }@@ -3672,13 +3672,15 @@ static int ni_cdio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)*/
drivers/staging/comedi/drivers/ni_mio_common.c static int ni_cdio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) · line 3678
Quoted 10 lines
drivers/staging/comedi/drivers/ni_mio_common.c +4
-4cdo_mode_bits =NI_M_CDO_MODE_FIFO_MODE |NI_M_CDO_MODE_HALT_ON_ERROR | -NI_M_CDO_MODE_SAMPLE_SRC ( -ni_get_reg_value (CR_CHAN (cmd->scan_begin_arg), - NI_DO_SampleClock, - &devpriv->routing_tables)); +NI_M_CDO_MODE_SAMPLE_SRC (ni_get_reg_value ( +CR_CHAN (cmd->scan_begin_arg), + NI_DO_SampleClock, + &devpriv->routing_tables));
These like the earlier ones are probably better left as is.
drivers/staging/comedi/drivers/ni_mio_common.c static int ni_cdio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) · line 3683
Quoted 5 lines
drivers/staging/comedi/drivers/ni_mio_common.c +2
-0if (cmd->scan_begin_arg &CR_INVERT ) cdo_mode_bits |=NI_M_CDO_MODE_POLARITY ; +ni_writel (dev, cdo_mode_bits,NI_M_CDO_MODE_REG ); +
I'm not sure what motivated adding these blank lines, but it doesn't seem to be the same issue as what is done in the rest of the patch.
julia
Quoted 11 lines
drivers/staging/comedi/drivers/ni_mio_common.c +0
-1if (s->io_bits) {ni_writel (dev, s->state,NI_M_CDO_FIFO_DATA_REG );ni_writel (dev,NI_M_CDO_CMD_SW_UPDATE ,NI_M_CDIO_CMD_REG ); --2.17.1
--
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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20200314194724.GA2711%40deeUbuntu.
Quoted 30 lines · Julia Lawall
Quoted 1 line · Deepak R Varma
Resolve general code indentation problems as detected by checkpatch
script.
Review
Quoted 9 lines
Implement code reformat and re-indentation as per coding style to improve readability.
Signed-off-by Deepak R Varma <[email protected] <javascript:>>---
.../staging/comedi/drivers/ni_mio_common.c | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-)(quoted diff) +0
-0
b/drivers/staging/comedi/drivers/ni_mio_common.cdrivers/staging/comedi/drivers/ni_mio_common.c static int ni_ai_cmd(struct comedi_device *dev,
Quoted 4 lines
index
b72a40a79930..48e20de3ebcf100644drivers/staging/comedi/drivers/ni_mio_common.c +0
-0@@ -2198,10 +2198,10 @@ static int ni_ai_cmd(struct comedi_device *dev,struct
comedi_subdevice*s)drivers/staging/comedi/drivers/ni_mio_common.c static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
Quoted 7 lines
drivers/staging/comedi/drivers/ni_mio_common.c +0
-4NISTC_AI_TRIG_START1_SEL (0 );break ;case TRIG_EXT : - ai_trig |= NISTC_AI_TRIG_START1_SEL( - ni_get_reg_value_roffs(CR_CHAN(cmd->start_arg), - NI_AI_StartTrigger, -
&devpriv->routing_tables, 1));
Quoted 9 lines
drivers/staging/comedi/drivers/ni_mio_common.c static int ni_ai_cmd(struct comedi_device *dev, · line 2201
Quoted 1 line
drivers/staging/comedi/drivers/ni_mio_common.c +1
-0+ ai_trig |=NISTC_AI_TRIG_START1_SEL(ni_get_reg_value_roffs(
drivers/staging/comedi/drivers/ni_mio_common.c static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) · line 2204
Quoted 3 lines
drivers/staging/comedi/drivers/ni_mio_common.c +3
-0+CR_CHAN (cmd->start_arg), + NI_AI_StartTrigger, + &devpriv->routing_tables, 1));These may have been better as they were. At least the two function calls are more visible in the original.
I think the reformatting makes it look simpler and more readable. Did you review it in mutt or here on this page? Please confirm if you want me to revert these back.
Quoted 20 lines
[...]
drivers/staging/comedi/drivers/ni_mio_common.c static void ni_ao_cmd_set_update(struct
Quoted 1 line
drivers/staging/comedi/drivers/ni_mio_common.c +0
-0@@ -3079,12 +3081,10 @@ static void ni_ao_cmd_set_update(struct
comedi_device*dev,drivers/staging/comedi/drivers/ni_mio_common.c static void ni_ao_cmd_set_update(struct · line 3081
Quoted 1 line
drivers/staging/comedi/drivers/ni_mio_common.c +0
-0* zero out these bit fields to be set below. Does an ao-reset do this
drivers/staging/comedi/drivers/ni_mio_common.c static void ni_ao_cmd_set_update(struct comedi_device *dev, · line 3087
Quoted 12 lines
drivers/staging/comedi/drivers/ni_mio_common.c +4
-6* automatically? */ - devpriv->ao_mode1 &= ~( -NISTC_AO_MODE1_UI_SRC_MASK | -NISTC_AO_MODE1_UI_SRC_POLARITY | -NISTC_AO_MODE1_UPDATE_SRC_MASK | -NISTC_AO_MODE1_UPDATE_SRC_POLARITY - ); + devpriv->ao_mode1 &= ~(NISTC_AO_MODE1_UI_SRC_MASK | +NISTC_AO_MODE1_UI_SRC_POLARITY | +NISTC_AO_MODE1_UPDATE_SRC_MASK | +NISTC_AO_MODE1_UPDATE_SRC_POLARITY );
Quoted 4 lines
This looks like an improveemnt. Are the subsequent NISTCs lines up with the right side of the (? It doesn't look like it, but the +s can change the appearance of the indentation.
sorry, I did not follow this fully. Could you please explain what do you mean by improvement? There is no code change. I only realigned the NISTC* lines so that the "&= ~(" part is clearly visible. It definitely looks different here on the web page that the vi editor.
Quoted 41 lines
drivers/staging/comedi/drivers/ni_mio_common.c static void ni_ao_cmd_set_update(struct
Quoted 5 lines
drivers/staging/comedi/drivers/ni_mio_common.c +0
-0if (cmd->scan_begin_src ==TRIG_TIMER ) {unsigned int trigvar;@@ -3133,10 +3133,10 @@ static void ni_ao_cmd_set_update(struct
comedi_device*dev,drivers/staging/comedi/drivers/ni_mio_common.c static void ni_ao_cmd_set_update(struct · line 3134
Quoted 2 lines
drivers/staging/comedi/drivers/ni_mio_common.c +0
-0}else {/* TRIG_EXT */ /* FIXME: assert scan_begin_arg != 0, ret failure otherwise */
drivers/staging/comedi/drivers/ni_mio_common.c static void ni_ao_cmd_set_update(struct comedi_device *dev,
Quoted 6 lines
drivers/staging/comedi/drivers/ni_mio_common.c +1
-4devpriv->ao_cmd2 |=NISTC_AO_CMD2_BC_GATE_ENA ; - devpriv->ao_mode1 |=NISTC_AO_MODE1_UPDATE_SRC ( -ni_get_reg_value (CR_CHAN (cmd->scan_begin_arg), - NI_AO_SampleClock, - &devpriv->routing_tables)); + devpriv->ao_mode1 |=NISTC_AO_MODE1_UPDATE_SRC(ni_get_reg_value(
Quoted 1 line
+
CR_CHAN(cmd->scan_begin_arg),Quoted 2 lines
+
NI_AO_SampleClock,+
&devpriv->routing_tables));Quoted 2 lines
if (cmd->scan_begin_arg & CR_INVERT) devpriv->ao_mode1 |=
NISTC_AO_MODE1_UPDATE_SRC_POLARITY;drivers/staging/comedi/drivers/ni_mio_common.c static int ni_cdio_cmd(struct comedi_device
Quoted 2 lines
}drivers/staging/comedi/drivers/ni_mio_common.c +0
-0@@ -3672,13 +3672,15 @@ static int ni_cdio_cmd(struct comedi_device*dev, struct
comedi_subdevice*s)drivers/staging/comedi/drivers/ni_mio_common.c static int ni_cdio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
Quoted 5 lines
drivers/staging/comedi/drivers/ni_mio_common.c +0
-1*/ cdo_mode_bits =NI_M_CDO_MODE_FIFO_MODE | NI_M_CDO_MODE_HALT_ON_ERROR | - NI_M_CDO_MODE_SAMPLE_SRC(- ni_get_reg_value(CR_CHAN(cmd->scan_begin_arg),
drivers/staging/comedi/drivers/ni_mio_common.c static int ni_cdio_cmd(struct comedi_device · line 3678
Quoted 2 lines
drivers/staging/comedi/drivers/ni_mio_common.c +0
-2- NI_DO_SampleClock, -
&devpriv->routing_tables));drivers/staging/comedi/drivers/ni_mio_common.c static int ni_cdio_cmd(struct comedi_device · line 3677
Quoted 2 lines
drivers/staging/comedi/drivers/ni_mio_common.c +1
-0+ NI_M_CDO_MODE_SAMPLE_SRC(ni_get_reg_value(
Quoted 9 lines
+
CR_CHAN(cmd->scan_begin_arg),drivers/staging/comedi/drivers/ni_mio_common.c static int ni_cdio_cmd(struct comedi_device · line 3679
Quoted 2 lines
drivers/staging/comedi/drivers/ni_mio_common.c +1
-0+ NI_DO_SampleClock,+
&devpriv->routing_tables));These like the earlier ones are probably better left as is.
Same as above. Please confirm if you want me to revert these.
Quoted 9 lines
drivers/staging/comedi/drivers/ni_mio_common.c static int ni_cdio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) · line 3683
Quoted 5 lines
drivers/staging/comedi/drivers/ni_mio_common.c +2
-0if (cmd->scan_begin_arg &CR_INVERT ) cdo_mode_bits |=NI_M_CDO_MODE_POLARITY ; +ni_writel (dev, cdo_mode_bits,NI_M_CDO_MODE_REG ); +I'm not sure what motivated adding these blank lines, but it doesn't seem to be the same issue as what is done in the rest of the patch.
I think with the new line in place, it makes it easier to spot the ni_write function call easily. Otherwise it may get overlooked during a quick glace of this area. Let me know if you still think the new line is unnecessary and I will revert it. No problem.
Quoted 20 lines
julia
drivers/staging/comedi/drivers/ni_mio_common.c static int ni_cdio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
Quoted 3 lines
drivers/staging/comedi/drivers/ni_mio_common.c +0
-0if (s->io_bits) {ni_writel (dev, s->state,NI_M_CDO_FIFO_DATA_REG ); ni_writel(dev, NI_M_CDO_CMD_SW_UPDATE,
NI_M_CDIO_CMD_REG);Quoted 5 lines
Signature · 4 lines
2.17.1 -- You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected] <javascript:>.
Quoted 1 line
To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20200314194724.GA2711%40deeUbuntu.
Quoted 1 line
Quoted 37 lines · Deepak Varma
On Sunday, 15 March 2020 01:27:27 UTC+5:30, Julia Lawall wrote:
On Sun, 15 Mar 2020, Deepak R Varma wrote: > Resolve general code indentation problems as detected by checkpatch script. > Implement code reformat and re-indentation as per coding style to > improve readability. > > Signed-off-by: Deepak R Varma <[email protected]> > --- > .../staging/comedi/drivers/ni_mio_common.c | 62 ++++++++++--------- > 1 file changed, 32 insertions(+), 30 deletions(-) > > diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c > index b72a40a79930..48e20de3ebcf 100644 > --- a/drivers/staging/comedi/drivers/ni_mio_common.c > +++ b/drivers/staging/comedi/drivers/ni_mio_common.c > @@ -2198,10 +2198,10 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) > NISTC_AI_TRIG_START1_SEL(0); > break; > case TRIG_EXT: > - ai_trig |= NISTC_AI_TRIG_START1_SEL( > - ni_get_reg_value_roffs(CR_CHAN(cmd->start_arg), > - NI_AI_StartTrigger, > - &devpriv->routing_tables, 1)); > + ai_trig |= NISTC_AI_TRIG_START1_SEL(ni_get_reg_value_roffs( > + CR_CHAN(cmd->start_arg), > + NI_AI_StartTrigger, > + &devpriv->routing_tables, 1)); These may have been better as they were. At least the two function calls are more visible in the original.
Quoted 1 line
I think the reformatting makes it look simpler and more readable. Did you review it in mutt or here on this page? Please confirm if you want me to revert these back.
It looks strange to have the call to ni_get_reg_value_roffs to the right of its arguments. It looks like the arguments are the arguments of NISTC_AI_TRIG_START1_SEL.
Quoted 18 lines
[...]
> @@ -3079,12 +3081,10 @@ static void ni_ao_cmd_set_update(struct
comedi_device*dev, > * zero out these bit fields to be set below. Does an ao-reset do this > * automatically?
> */
> - devpriv->ao_mode1 &= ~(
> - NISTC_AO_MODE1_UI_SRC_MASK |
> - NISTC_AO_MODE1_UI_SRC_POLARITY |
> - NISTC_AO_MODE1_UPDATE_SRC_MASK |
> - NISTC_AO_MODE1_UPDATE_SRC_POLARITY
> - );
> + devpriv->ao_mode1 &= ~(NISTC_AO_MODE1_UI_SRC_MASK | > + NISTC_AO_MODE1_UI_SRC_POLARITY | > + NISTC_AO_MODE1_UPDATE_SRC_MASK | > + NISTC_AO_MODE1_UPDATE_SRC_POLARITY);
Quoted 7 lines
This looks like an improveemnt. Are the subsequent NISTCs lines up with the right side of the (? It doesn't look like it, but the +s can change the appearance of the indentation.
sorry, I did not follow this fully. Could you please explain what do you mean by improvement? There is no code change. I only realigned the NISTC* lines so that the "&= ~(" part is clearly visible. It definitely looks different here on the web page that the vi editor.
I would expect
(NISTC_AO_MODE1...
NISTC_AO_MODE1...
NISTC_AO_MODE1...
NISTC_AO_MODE1...As far as I can see, you have
(NISTC_AO_MODE1...
NISTC_AO_MODE1...
NISTC_AO_MODE1...
NISTC_AO_MODE1...Quoted 48 lines
> if (cmd->scan_begin_src == TRIG_TIMER) { > unsigned int trigvar; > @@ -3133,10 +3133,10 @@ static void ni_ao_cmd_set_update(struct comedi_device *dev, > } else { /* TRIG_EXT */ > /* FIXME: assert scan_begin_arg != 0, ret failure otherwise */ > devpriv->ao_cmd2 |= NISTC_AO_CMD2_BC_GATE_ENA; > - devpriv->ao_mode1 |= NISTC_AO_MODE1_UPDATE_SRC( > - ni_get_reg_value(CR_CHAN(cmd->scan_begin_arg), > - NI_AO_SampleClock, > - &devpriv->routing_tables)); > + devpriv->ao_mode1 |= NISTC_AO_MODE1_UPDATE_SRC(ni_get_reg_value( > + CR_CHAN(cmd->scan_begin_arg), > + NI_AO_SampleClock, > + &devpriv->routing_tables)); > if (cmd->scan_begin_arg & CR_INVERT) > devpriv->ao_mode1 |= NISTC_AO_MODE1_UPDATE_SRC_POLARITY; > } > @@ -3672,13 +3672,15 @@ static int ni_cdio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) > */ > cdo_mode_bits = NI_M_CDO_MODE_FIFO_MODE | > NI_M_CDO_MODE_HALT_ON_ERROR | > - NI_M_CDO_MODE_SAMPLE_SRC( > - ni_get_reg_value(CR_CHAN(cmd->scan_begin_arg), > - NI_DO_SampleClock, > - &devpriv->routing_tables)); > + NI_M_CDO_MODE_SAMPLE_SRC(ni_get_reg_value( > + CR_CHAN(cmd->scan_begin_arg), > + NI_DO_SampleClock, > + &devpriv->routing_tables)); These like the earlier ones are probably better left as is.Same as above. Please confirm if you want me to revert these.
> if (cmd->scan_begin_arg & CR_INVERT) > cdo_mode_bits |= NI_M_CDO_MODE_POLARITY; > + > ni_writel(dev, cdo_mode_bits, NI_M_CDO_MODE_REG); > + I'm not sure what motivated adding these blank lines, but it doesn't seem to be the same issue as what is done in the rest of the patch.
Quoted 2 lines
I think with the new line in place, it makes it easier to spot the
ni_writefunction call easily. Otherwise it may get overlooked during a quick glace of this area. Let me know if you still think the new line is unnecessary and I will revert it. No problem.
It's not so much of whether it is necessary or not. The point is just that none of the other changes involve adding new blank lines. So these look like a different kind of change than the rest.
julia
Quoted 20 lines
julia > if (s->io_bits) { > ni_writel(dev, s->state, NI_M_CDO_FIFO_DATA_REG); > ni_writel(dev, NI_M_CDO_CMD_SW_UPDATE, NI_M_CDIO_CMD_REG); > -- > 2.17.1 > > -- > 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 [email protected]. > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20200314194724.GA2711%40deeUbuntu. >--
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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/facae09d-0a64-4007-af28-d9da637a95c8%40googlegroups.com.
Quoted 54 lines · Julia Lawall
Quoted 8 lines · Deepak Varma
On Sunday, 15 March 2020 01:27:27 UTC+5:30, Julia Lawall wrote:
On Sun, 15 Mar 2020, Deepak R Varma wrote:
> Resolve general code indentation problems as detected by
checkpatch script.
Quoted 1 line
> Implement code reformat and re-indentation as per coding style
to
Quoted 5 lines
> improve readability. > > Signed-off-by: Deepak R Varma <[email protected]> > --- > .../staging/comedi/drivers/ni_mio_common.c | 62++++++++++---------
Quoted 3 lines
> 1 file changed, 32 insertions(+), 30 deletions(-) > > diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c
b/drivers/staging/comedi/drivers/ni_mio_common.cQuoted 4 lines
> index
b72a40a79930..48e20de3ebcf100644
> ---a/drivers/staging/comedi/drivers/ni_mio_common.c> +++b/drivers/staging/comedi/drivers/ni_mio_common.c> @@ -2198,10 +2198,10 @@ static int ni_ai_cmd(struct
comedi_device*dev, structcomedi_subdevice*s)Quoted 5 lines
> NISTC_AI_TRIG_START1_SEL(0); > break; > case TRIG_EXT: > - ai_trig |= NISTC_AI_TRIG_START1_SEL( >- ni_get_reg_value_roffs(CR_CHAN(cmd->start_arg),
Quoted 1 line
> -
NI_AI_StartTrigger,Quoted 1 line
> -
&devpriv->routing_tables, 1));Quoted 1 line
> + ai_trig |=NISTC_AI_TRIG_START1_SEL(ni_get_reg_value_roffs(
Quoted 1 line
>+
CR_CHAN(cmd->start_arg),Quoted 2 lines
> +
NI_AI_StartTrigger,
>+
&devpriv->routing_tables, 1));Quoted 2 lines
These may have been better as they were. At least the two
function calls
Quoted 3 lines
are more visible in the original.
Quoted 8 lines
Quoted 1 line
I think the reformatting makes it look simpler and more readable. Did
you review it in mutt or here on this page? Please confirm if you want me to revert these back.
It looks strange to have the call to
ni_get_reg_value_roffsto the right of its arguments. It looks like the arguments are the arguments ofNISTC_AI_TRIG_START1_SEL.
I understand now. Makes sense. Let me try refining it and resend in v2.
Quoted 127 lines
Quoted 5 lines
[...] > @@ -3079,12 +3081,10 @@ static void ni_ao_cmd_set_update(struct
comedi_device*dev,Quoted 1 line
> * zero out these bit fields to be set below. Does an
ao-reset do this
Quoted 9 lines
> * automatically?
> */
> -devpriv->ao_mode1&= ~(
> -NISTC_AO_MODE1_UI_SRC_MASK|
> -NISTC_AO_MODE1_UI_SRC_POLARITY|
> -NISTC_AO_MODE1_UPDATE_SRC_MASK|
> -NISTC_AO_MODE1_UPDATE_SRC_POLARITY
> - );
> +devpriv->ao_mode1&= ~(NISTC_AO_MODE1_UI_SRC_MASK|
Quoted 1 line
> +
NISTC_AO_MODE1_UI_SRC_POLARITY|Quoted 1 line
> +
NISTC_AO_MODE1_UPDATE_SRC_MASK|Quoted 1 line
>+
NISTC_AO_MODE1_UPDATE_SRC_POLARITY);Quoted 2 lines
This looks like an improveemnt. Are the subsequent NISTCs lines
up with
Quoted 1 line
the right side of the (? It doesn't look like it, but the +s can
change
Quoted 4 lines
the appearance of the indentation.
sorry, I did not follow this fully. Could you please explain what do you
mean by improvement? There is no code change. I only realigned the NISTC* lines so that the "&= ~(" part is clearly visible. It definitely looks different here on the web page
Quoted 1 line
that the vi editor.
I would expect
(NISTC_AO_MODE1... NISTC_AO_MODE1... NISTC_AO_MODE1... NISTC_AO_MODE1...As far as I can see, you have
(NISTC_AO_MODE1... NISTC_AO_MODE1... NISTC_AO_MODE1... NISTC_AO_MODE1...Yeah. I should correct that. Will include in v2. Thank you!
Quoted 5 lines
> if (cmd->scan_begin_src == TRIG_TIMER) { > unsigned int trigvar; > @@ -3133,10 +3133,10 @@ static void ni_ao_cmd_set_update(struct
comedi_device*dev,Quoted 2 lines
> } else { /*
TRIG_EXT*/
> /* FIXME: assertscan_begin_arg!= 0, retfailure otherwise */
Quoted 3 lines
> devpriv->ao_cmd2 |= NISTC_AO_CMD2_BC_GATE_ENA; > - devpriv->ao_mode1 |= NISTC_AO_MODE1_UPDATE_SRC( >- ni_get_reg_value(CR_CHAN(cmd->scan_begin_arg),
Quoted 2 lines
> -
NI_AO_SampleClock,
> -
&devpriv->routing_tables));Quoted 1 line
> + devpriv->ao_mode1 |=NISTC_AO_MODE1_UPDATE_SRC(ni_get_reg_value(
Quoted 1 line
>+
CR_CHAN(cmd->scan_begin_arg),Quoted 1 line
>+
NI_AO_SampleClock,Quoted 1 line
>+
&devpriv->routing_tables));Quoted 2 lines
> if (cmd->scan_begin_arg & CR_INVERT) > devpriv->ao_mode1 |=
NISTC_AO_MODE1_UPDATE_SRC_POLARITY;Quoted 2 lines
> } > @@ -3672,13 +3672,15 @@ static int ni_cdio_cmd(struct
comedi_device*dev, structcomedi_subdevice*s)Quoted 5 lines
> */
>cdo_mode_bits=NI_M_CDO_MODE_FIFO_MODE|
>NI_M_CDO_MODE_HALT_ON_ERROR|
> - NI_M_CDO_MODE_SAMPLE_SRC(
>- ni_get_reg_value(CR_CHAN(cmd->scan_begin_arg),
Quoted 1 line
> -
NI_DO_SampleClock,Quoted 1 line
> -
&devpriv->routing_tables));Quoted 1 line
>+ NI_M_CDO_MODE_SAMPLE_SRC(ni_get_reg_value(
Quoted 1 line
>+
CR_CHAN(cmd->scan_begin_arg),Quoted 1 line
>+
NI_DO_SampleClock,Quoted 1 line
>+
&devpriv->routing_tables));Quoted 7 lines
These like the earlier ones are probably better left as is.
Same as above. Please confirm if you want me to revert these.
Quoted 7 lines
> if (cmd->scan_begin_arg & CR_INVERT) > cdo_mode_bits |= NI_M_CDO_MODE_POLARITY; > + > ni_writel(dev, cdo_mode_bits, NI_M_CDO_MODE_REG); > + I'm not sure what motivated adding these blank lines, but itdoesn't seem
Quoted 4 lines
to be the same issue as what is done in the rest of the patch.
I think with the new line in place, it makes it easier to spot the
Quoted 9 lines
ni_writefunction call easily. Otherwise it may get overlooked during a quick glace of this area. Let me know if you still think the new line is unnecessary and I will revert it. NoQuoted 1 line
problem.
It's not so much of whether it is necessary or not. The point is just that none of the other changes involve adding new blank lines. So these look like a different kind of change than the rest.
Okay. I will revert it in v2. Thank you.
Quoted 33 lines
julia
Quoted 4 lines
julia > if (s->io_bits) { > ni_writel(dev, s->state,
NI_M_CDO_FIFO_DATA_REG);Quoted 1 line
> ni_writel(dev,
NI_M_CDO_CMD_SW_UPDATE,
NI_M_CDIO_CMD_REG);Quoted 5 lines
> -- > 2.17.1 > > -- > You received this message because you are subscribed to theGoogle Groups "outreachy-kernel" group.
Quoted 1 line
> To unsubscribe from this group and stop receiving emails from
it, send an email to [email protected].
Quoted 1 line
> To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20200314194724.GA2711%40deeUbuntu.
Quoted 4 lines
>Signature · 1 line
You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected] <javascript:>.
Quoted 1 line
To view this discussion on the web visit
Quoted 2 lines