staging: comedi: hwdrv_apci3120: fix 'b_AiCyclicAcquisition' usage
This private data member is set when an analog input async command is started by apci3120_cyclic_ai() and cleared when the command finishes or is canceled. Rename the CamelCase member to 'ai_running' and convert it to a bit-field flag. Remove the unnecessary clearing of the flag before or after calling apci3120_cancel(). Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a19f716158
commit
204563198e
drivers/staging/comedi/drivers/addi-data
|
@ -137,7 +137,7 @@ struct addi_private {
|
||||||
unsigned short us_OutputRegister; /* Contain data written at iobase + 0 */
|
unsigned short us_OutputRegister; /* Contain data written at iobase + 0 */
|
||||||
unsigned char b_Timer2Mode; /* Specify the timer 2 mode */
|
unsigned char b_Timer2Mode; /* Specify the timer 2 mode */
|
||||||
unsigned char b_Timer2Interrupt; /* Timer2 interrupt enable or disable */
|
unsigned char b_Timer2Interrupt; /* Timer2 interrupt enable or disable */
|
||||||
unsigned char b_AiCyclicAcquisition; /* indicate cyclic acquisition */
|
unsigned int ai_running:1;
|
||||||
unsigned char b_InterruptMode; /* eoc eos or dma */
|
unsigned char b_InterruptMode; /* eoc eos or dma */
|
||||||
unsigned char b_EocEosInterrupt; /* Enable disable eoc eos interrupt */
|
unsigned char b_EocEosInterrupt; /* Enable disable eoc eos interrupt */
|
||||||
unsigned int ui_EocEosConversionTime;
|
unsigned int ui_EocEosConversionTime;
|
||||||
|
|
|
@ -609,7 +609,7 @@ static int apci3120_reset(struct comedi_device *dev)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned short us_TmpValue;
|
unsigned short us_TmpValue;
|
||||||
|
|
||||||
devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE;
|
devpriv->ai_running = 0;
|
||||||
devpriv->b_EocEosInterrupt = APCI3120_DISABLE;
|
devpriv->b_EocEosInterrupt = APCI3120_DISABLE;
|
||||||
devpriv->b_InterruptMode = APCI3120_EOC_MODE;
|
devpriv->b_InterruptMode = APCI3120_EOC_MODE;
|
||||||
devpriv->ui_EocEosConversionTime = 0; /* set eoc eos conv time to 0 */
|
devpriv->ui_EocEosConversionTime = 0; /* set eoc eos conv time to 0 */
|
||||||
|
@ -722,7 +722,7 @@ static int apci3120_cancel(struct comedi_device *dev,
|
||||||
s->async->cur_chan = 0;
|
s->async->cur_chan = 0;
|
||||||
devpriv->ui_DmaActualBuffer = 0;
|
devpriv->ui_DmaActualBuffer = 0;
|
||||||
|
|
||||||
devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE;
|
devpriv->ai_running = 0;
|
||||||
devpriv->b_InterruptMode = APCI3120_EOC_MODE;
|
devpriv->b_InterruptMode = APCI3120_EOC_MODE;
|
||||||
devpriv->b_EocEosInterrupt = APCI3120_DISABLE;
|
devpriv->b_EocEosInterrupt = APCI3120_DISABLE;
|
||||||
apci3120_reset(dev);
|
apci3120_reset(dev);
|
||||||
|
@ -817,10 +817,6 @@ static int apci3120_cyclic_ai(int mode,
|
||||||
0, ui_TimerValue0, ui_ConvertTiming;
|
0, ui_TimerValue0, ui_ConvertTiming;
|
||||||
unsigned short us_TmpValue;
|
unsigned short us_TmpValue;
|
||||||
|
|
||||||
/* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */
|
|
||||||
/* devpriv->b_AiCyclicAcquisition=APCI3120_ENABLE; */
|
|
||||||
/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
|
|
||||||
|
|
||||||
/*******************/
|
/*******************/
|
||||||
/* Resets the FIFO */
|
/* Resets the FIFO */
|
||||||
/*******************/
|
/*******************/
|
||||||
|
@ -830,12 +826,7 @@ static int apci3120_cyclic_ai(int mode,
|
||||||
/* inw(dev->iobase+APCI3120_RD_STATUS); */
|
/* inw(dev->iobase+APCI3120_RD_STATUS); */
|
||||||
/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
|
/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
|
||||||
|
|
||||||
/***************************/
|
devpriv->ai_running = 1;
|
||||||
/* Acquisition initialized */
|
|
||||||
/***************************/
|
|
||||||
/* BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver */
|
|
||||||
devpriv->b_AiCyclicAcquisition = APCI3120_ENABLE;
|
|
||||||
/* END JK 07.05.04: Comparison between WIN32 and Linux driver */
|
|
||||||
|
|
||||||
/* clear software registers */
|
/* clear software registers */
|
||||||
devpriv->b_TimerSelectMode = 0;
|
devpriv->b_TimerSelectMode = 0;
|
||||||
|
@ -1388,8 +1379,6 @@ static void apci3120_interrupt_dma(int irq, void *d)
|
||||||
if (samplesinbuf & 1) {
|
if (samplesinbuf & 1) {
|
||||||
comedi_error(dev, "Odd count of bytes in DMA ring!");
|
comedi_error(dev, "Odd count of bytes in DMA ring!");
|
||||||
apci3120_cancel(dev, s);
|
apci3120_cancel(dev, s);
|
||||||
devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
samplesinbuf = samplesinbuf >> 1; /* number of received samples */
|
samplesinbuf = samplesinbuf >> 1; /* number of received samples */
|
||||||
|
@ -1459,7 +1448,6 @@ static void apci3120_interrupt_dma(int irq, void *d)
|
||||||
if (devpriv->ui_AiActualScan >= cmd->stop_arg) {
|
if (devpriv->ui_AiActualScan >= cmd->stop_arg) {
|
||||||
/* all data sampled */
|
/* all data sampled */
|
||||||
apci3120_cancel(dev, s);
|
apci3120_cancel(dev, s);
|
||||||
devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE;
|
|
||||||
s->async->events |= COMEDI_CB_EOA;
|
s->async->events |= COMEDI_CB_EOA;
|
||||||
comedi_event(dev, s);
|
comedi_event(dev, s);
|
||||||
return;
|
return;
|
||||||
|
@ -1609,7 +1597,7 @@ static void apci3120_interrupt(int irq, void *d)
|
||||||
|
|
||||||
if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE) { /* enable this in without DMA ??? */
|
if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE) { /* enable this in without DMA ??? */
|
||||||
|
|
||||||
if (devpriv->b_AiCyclicAcquisition == APCI3120_ENABLE) {
|
if (devpriv->ai_running) {
|
||||||
ui_Check = 0;
|
ui_Check = 0;
|
||||||
apci3120_interrupt_handle_eos(dev);
|
apci3120_interrupt_handle_eos(dev);
|
||||||
devpriv->ui_AiActualScan++;
|
devpriv->ui_AiActualScan++;
|
||||||
|
@ -1651,8 +1639,6 @@ static void apci3120_interrupt(int irq, void *d)
|
||||||
|
|
||||||
switch (devpriv->b_Timer2Mode) {
|
switch (devpriv->b_Timer2Mode) {
|
||||||
case APCI3120_COUNTER:
|
case APCI3120_COUNTER:
|
||||||
|
|
||||||
devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE;
|
|
||||||
devpriv->b_ModeSelectRegister =
|
devpriv->b_ModeSelectRegister =
|
||||||
devpriv->
|
devpriv->
|
||||||
b_ModeSelectRegister & APCI3120_DISABLE_EOS_INT;
|
b_ModeSelectRegister & APCI3120_DISABLE_EOS_INT;
|
||||||
|
@ -1668,7 +1654,6 @@ static void apci3120_interrupt(int irq, void *d)
|
||||||
|
|
||||||
/* stop timer 0 and timer 1 */
|
/* stop timer 0 and timer 1 */
|
||||||
apci3120_cancel(dev, s);
|
apci3120_cancel(dev, s);
|
||||||
devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE;
|
|
||||||
|
|
||||||
/* UPDATE-0.7.57->0.7.68comedi_done(dev,s); */
|
/* UPDATE-0.7.57->0.7.68comedi_done(dev,s); */
|
||||||
s->async->events |= COMEDI_CB_EOA;
|
s->async->events |= COMEDI_CB_EOA;
|
||||||
|
@ -1707,7 +1692,7 @@ static void apci3120_interrupt(int irq, void *d)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((int_daq & 0x4) && (devpriv->b_InterruptMode == APCI3120_DMA_MODE)) {
|
if ((int_daq & 0x4) && (devpriv->b_InterruptMode == APCI3120_DMA_MODE)) {
|
||||||
if (devpriv->b_AiCyclicAcquisition == APCI3120_ENABLE) {
|
if (devpriv->ai_running) {
|
||||||
|
|
||||||
/****************************/
|
/****************************/
|
||||||
/* Clear Timer Write TC int */
|
/* Clear Timer Write TC int */
|
||||||
|
|
Loading…
Reference in New Issue