From: H Hartley Sweeten Date: Tue, 29 Apr 2014 19:59:47 +0000 (-0700) Subject: staging: comedi: addi_common.h: remove 'b_AiContinuous' from private data X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=2f673c5d10511e790de97ab885878cbad1678245;p=openwrt%2Fstaging%2Fblogic.git staging: comedi: addi_common.h: remove 'b_AiContinuous' from private data This member of the private data can be determined by checking the cmd->stop_src. Do that instead. Fix the b_AiContinuous check in apci3120_ai_cmd(). The (*do_cmdtest) validates that the cmd->stop_arg os >= 1 for TRIG_COUNT and 0 for TRIG_NONE. The correct test to set this flag is (cmd->stop_src == TRIG_NONE). Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h index 7471a0a9e13e..c55c5dae688e 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h @@ -118,7 +118,6 @@ struct addi_private { int i_IobaseAmcc; /* base+size for AMCC chip */ int i_IobaseAddon; /* addon base address */ int i_IobaseReserved; - unsigned char b_AiContinuous; /* we do unlimited AI */ unsigned int ui_AiActualScan; /* how many scans we finished */ unsigned int ui_AiNbrofChannels; /* how many channels is measured */ unsigned int ui_AiChannelList[32]; /* actual chanlist */ diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index e4b92767b8ad..b9780768f88f 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -720,7 +720,6 @@ static int apci3120_cancel(struct comedi_device *dev, inw(dev->iobase + APCI3120_RD_STATUS); devpriv->ui_AiActualScan = 0; s->async->cur_chan = 0; - devpriv->b_AiContinuous = 0; devpriv->ui_DmaActualBuffer = 0; devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE; @@ -1038,7 +1037,7 @@ static int apci3120_cyclic_ai(int mode, outb(devpriv->b_ModeSelectRegister, dev->iobase + APCI3120_WRITE_MODE_SELECT); - if (!devpriv->b_AiContinuous) { + if (cmd->stop_src == TRIG_COUNT) { /* * configure Timer2 For counting EOS Reset gate 2 of Timer 2 to * disable it (Set Bit D14 to 0) @@ -1125,7 +1124,7 @@ static int apci3120_cyclic_ai(int mode, dmalen0 = devpriv->ui_DmaBufferSize[0]; dmalen1 = devpriv->ui_DmaBufferSize[1]; - if (!devpriv->b_AiContinuous) { + if (cmd->stop_src == TRIG_COUNT) { /* * Must we fill full first buffer? And must we fill * full second buffer when first is once filled? @@ -1294,8 +1293,8 @@ static int apci3120_cyclic_ai(int mode, /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ } - if ((devpriv->us_UseDma == APCI3120_DISABLE) - && !devpriv->b_AiContinuous) { + if (devpriv->us_UseDma == APCI3120_DISABLE && + cmd->stop_src == TRIG_COUNT) { /* set gate 2 to start conversion */ devpriv->us_OutputRegister = devpriv->us_OutputRegister | APCI3120_ENABLE_TIMER2; @@ -1340,10 +1339,6 @@ static int apci3120_ai_cmd(struct comedi_device *dev, /* loading private structure with cmd structure inputs */ devpriv->ui_AiNbrofChannels = cmd->chanlist_len; - if (cmd->stop_src == TRIG_NONE) - devpriv->b_AiContinuous = 1; /* user want neverending analog acquisition */ - /* stopped using cancel */ - if (cmd->start_src == TRIG_EXT) devpriv->b_ExttrigEnable = APCI3120_ENABLE; else @@ -1481,7 +1476,7 @@ static void apci3120_interrupt_dma(int irq, void *d) comedi_event(dev, s); } } - if (!devpriv->b_AiContinuous) + if (cmd->stop_src == TRIG_COUNT) if (devpriv->ui_AiActualScan >= cmd->stop_arg) { /* all data sampled */ apci3120_cancel(dev, s);