Commit 840d435f authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: amplc_pci230: collapse some 'else { if' chains

Where the only thing in an `else { ... }` block is another `if`
statement, collapse it to an `else if {` block where it makes sense to
do so.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cbbbd20d
...@@ -1844,23 +1844,17 @@ static void pci230_ai_update_fifo_trigger_level(struct comedi_device *dev, ...@@ -1844,23 +1844,17 @@ static void pci230_ai_update_fifo_trigger_level(struct comedi_device *dev,
unsigned short triglev; unsigned short triglev;
unsigned short adccon; unsigned short adccon;
if (cmd->flags & TRIG_WAKE_EOS) { if (cmd->flags & TRIG_WAKE_EOS)
/* Wake at end of scan. */
wake = scanlen - devpriv->ai_scan_pos; wake = scanlen - devpriv->ai_scan_pos;
} else { else if (cmd->stop_src != TRIG_COUNT ||
if (cmd->stop_src != TRIG_COUNT ||
devpriv->ai_scan_count >= PCI230_ADC_FIFOLEVEL_HALFFULL || devpriv->ai_scan_count >= PCI230_ADC_FIFOLEVEL_HALFFULL ||
scanlen >= PCI230_ADC_FIFOLEVEL_HALFFULL) { scanlen >= PCI230_ADC_FIFOLEVEL_HALFFULL)
wake = PCI230_ADC_FIFOLEVEL_HALFFULL; wake = PCI230_ADC_FIFOLEVEL_HALFFULL;
} else { else
wake = devpriv->ai_scan_count * scanlen - wake = devpriv->ai_scan_count * scanlen - devpriv->ai_scan_pos;
devpriv->ai_scan_pos;
}
}
if (wake >= PCI230_ADC_FIFOLEVEL_HALFFULL) { if (wake >= PCI230_ADC_FIFOLEVEL_HALFFULL) {
triglev = PCI230_ADC_INT_FIFO_HALF; triglev = PCI230_ADC_INT_FIFO_HALF;
} else { } else if (wake > 1 && devpriv->hwver > 0) {
if (wake > 1 && devpriv->hwver > 0) {
/* PCI230+/260+ programmable FIFO interrupt level. */ /* PCI230+/260+ programmable FIFO interrupt level. */
if (devpriv->adcfifothresh != wake) { if (devpriv->adcfifothresh != wake) {
devpriv->adcfifothresh = wake; devpriv->adcfifothresh = wake;
...@@ -1870,7 +1864,6 @@ static void pci230_ai_update_fifo_trigger_level(struct comedi_device *dev, ...@@ -1870,7 +1864,6 @@ static void pci230_ai_update_fifo_trigger_level(struct comedi_device *dev,
} else { } else {
triglev = PCI230_ADC_INT_FIFO_NEMPTY; triglev = PCI230_ADC_INT_FIFO_NEMPTY;
} }
}
adccon = (devpriv->adccon & ~PCI230_ADC_INT_FIFO_MASK) | triglev; adccon = (devpriv->adccon & ~PCI230_ADC_INT_FIFO_MASK) | triglev;
if (adccon != devpriv->adccon) { if (adccon != devpriv->adccon) {
devpriv->adccon = adccon; devpriv->adccon = adccon;
...@@ -2211,21 +2204,17 @@ static void pci230_handle_ai(struct comedi_device *dev, ...@@ -2211,21 +2204,17 @@ static void pci230_handle_ai(struct comedi_device *dev,
} else if (status_fifo & PCI230_ADC_FIFO_HALF) { } else if (status_fifo & PCI230_ADC_FIFO_HALF) {
/* FIFO half full. */ /* FIFO half full. */
fifoamount = PCI230_ADC_FIFOLEVEL_HALFFULL; fifoamount = PCI230_ADC_FIFOLEVEL_HALFFULL;
} else { } else if (devpriv->hwver > 0) {
/* FIFO not empty. */
if (devpriv->hwver > 0) {
/* Read PCI230+/260+ ADC FIFO level. */ /* Read PCI230+/260+ ADC FIFO level. */
fifoamount = inw(devpriv->daqio + fifoamount = inw(devpriv->daqio +
PCI230P_ADCFFLEV); PCI230P_ADCFFLEV);
if (fifoamount == 0) { if (fifoamount == 0)
/* Shouldn't happen. */ break; /* Shouldn't happen. */
break;
}
} else { } else {
/* FIFO not empty. */
fifoamount = 1; fifoamount = 1;
} }
} }
}
/* Read sample and store in Comedi's circular buffer. */ /* Read sample and store in Comedi's circular buffer. */
if (comedi_buf_put(s, pci230_ai_read(dev)) == 0) { if (comedi_buf_put(s, pci230_ai_read(dev)) == 0) {
events |= COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW; events |= COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment