diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2012-09-24 11:27:59 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-26 13:45:38 -0400 |
commit | 3cd73bc1cf59b2c9232d9889ba2b148e262054b6 (patch) | |
tree | 2284a3ed15ace430a80182ff36798138d39f8246 | |
parent | affdc230d7d328d2b602113e459a57d9de5ded08 (diff) |
staging: comedi: ni_mio_common: always lock in ni_ai_poll()
`ni_ai_poll()` currently acquires (and later releases) the comedi
device's spin-lock iff `in_interrupt()` returns 0. However, it is only
called during processing of a `COMEDI_POLL` ioctl so `in_interrupt()`
will always return 0 in this case. Remove this test and acquire/release
the spin-lock unconditionally. This eliminates a sparse warning about
different lock contexts for basic block.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/ni_mio_common.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 87995da00f61..4bbb9798af7e 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c | |||
@@ -1766,20 +1766,18 @@ static int ni_ai_reset(struct comedi_device *dev, struct comedi_subdevice *s) | |||
1766 | 1766 | ||
1767 | static int ni_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s) | 1767 | static int ni_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s) |
1768 | { | 1768 | { |
1769 | unsigned long flags = 0; | 1769 | unsigned long flags; |
1770 | int count; | 1770 | int count; |
1771 | 1771 | ||
1772 | /* lock to avoid race with interrupt handler */ | 1772 | /* lock to avoid race with interrupt handler */ |
1773 | if (in_interrupt() == 0) | 1773 | spin_lock_irqsave(&dev->spinlock, flags); |
1774 | spin_lock_irqsave(&dev->spinlock, flags); | ||
1775 | #ifndef PCIDMA | 1774 | #ifndef PCIDMA |
1776 | ni_handle_fifo_dregs(dev); | 1775 | ni_handle_fifo_dregs(dev); |
1777 | #else | 1776 | #else |
1778 | ni_sync_ai_dma(dev); | 1777 | ni_sync_ai_dma(dev); |
1779 | #endif | 1778 | #endif |
1780 | count = s->async->buf_write_count - s->async->buf_read_count; | 1779 | count = s->async->buf_write_count - s->async->buf_read_count; |
1781 | if (in_interrupt() == 0) | 1780 | spin_unlock_irqrestore(&dev->spinlock, flags); |
1782 | spin_unlock_irqrestore(&dev->spinlock, flags); | ||
1783 | 1781 | ||
1784 | return count; | 1782 | return count; |
1785 | } | 1783 | } |