release_dma_lock(flags);
}
+static unsigned int das16_isadma_disable(unsigned int dma_chan)
+{
+ unsigned long flags;
+ unsigned int residue;
+
+ flags = claim_dma_lock();
+ disable_dma(dma_chan);
+ residue = get_dma_residue(dma_chan);
+ release_dma_lock(flags);
+
+ return residue;
+}
+
static void das16_ai_enable(struct comedi_device *dev,
unsigned int mode, unsigned int src)
{
struct das16_private_struct *devpriv = dev->private;
static const int disable_limit = 100;
static const int enable_timeout = 100;
- int residue;
+ unsigned long flags;
+ unsigned int residue;
int new_residue;
int i;
int j;
- disable_dma(devpriv->dma_chan);
- residue = get_dma_residue(devpriv->dma_chan);
+ residue = das16_isadma_disable(devpriv->dma_chan);
for (i = 0; i < disable_limit && (residue % 2); ++i) {
+ flags = claim_dma_lock();
enable_dma(devpriv->dma_chan);
for (j = 0; j < enable_timeout; ++j) {
udelay(2);
new_residue = get_dma_residue(devpriv->dma_chan);
+ release_dma_lock(flags);
if (new_residue != residue)
break;
}
- disable_dma(devpriv->dma_chan);
- residue = get_dma_residue(devpriv->dma_chan);
+ residue = das16_isadma_disable(devpriv->dma_chan);
}
if (i == disable_limit) {
dev_err(dev->class_dev,
struct das16_dma_desc *dma = &devpriv->dma_desc[devpriv->cur_dma];
struct das16_dma_desc *nxt_dma;
unsigned long spin_flags;
- unsigned long dma_flags;
unsigned int nsamples;
int num_bytes, residue;
return;
}
- dma_flags = claim_dma_lock();
- clear_dma_ff(devpriv->dma_chan);
residue = disable_dma_on_even(dev);
- release_dma_lock(dma_flags);
/* figure out how many points to read */
if (residue > dma->size) {
{
struct das16_private_struct *devpriv = dev->private;
struct das16_dma_desc *dma;
- unsigned long flags;
int i;
if (!(dma_chan == 1 || dma_chan == 3))
return -ENOMEM;
}
- flags = claim_dma_lock();
- disable_dma(devpriv->dma_chan);
- release_dma_lock(flags);
+ das16_isadma_disable(devpriv->dma_chan);
init_timer(&devpriv->timer);
devpriv->timer.function = das16_timer_interrupt;