mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-28 12:25:31 +00:00
Staging: comedi: convert while loop to timeout in ni_mio_common.c
This patch for ni_mio_common.c changes out a while loop for a timeout, which is preferred. Signed-off-by: Chase Southwood <chase.southwood@yahoo.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8aee843abb
commit
60738f605b
@ -687,12 +687,22 @@ static void ni_clear_ai_fifo(struct comedi_device *dev)
|
||||
{
|
||||
const struct ni_board_struct *board = comedi_board(dev);
|
||||
struct ni_private *devpriv = dev->private;
|
||||
static const int timeout = 10000;
|
||||
int i;
|
||||
|
||||
if (board->reg_type == ni_reg_6143) {
|
||||
/* Flush the 6143 data FIFO */
|
||||
ni_writel(0x10, AIFIFO_Control_6143); /* Flush fifo */
|
||||
ni_writel(0x00, AIFIFO_Control_6143); /* Flush fifo */
|
||||
while (ni_readl(AIFIFO_Status_6143) & 0x10) ; /* Wait for complete */
|
||||
/* Wait for complete */
|
||||
for (i = 0; i < timeout; i++) {
|
||||
if (!(ni_readl(AIFIFO_Status_6143) & 0x10))
|
||||
break;
|
||||
udelay(1);
|
||||
}
|
||||
if (i == timeout) {
|
||||
comedi_error(dev, "FIFO flush timeout.");
|
||||
}
|
||||
} else {
|
||||
devpriv->stc_writew(dev, 1, ADC_FIFO_Clear);
|
||||
if (board->reg_type == ni_reg_625x) {
|
||||
|
Loading…
Reference in New Issue
Block a user