Disable all of a channel's interrupts when it is released.
authorFrank Mori Hess <fmhess@speakeasy.net>
Mon, 13 Aug 2007 15:12:27 +0000 (15:12 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Mon, 13 Aug 2007 15:12:27 +0000 (15:12 +0000)
comedi/drivers/mite.c

index 0efb7d881c1e1fcaf5802e80e4ad4b3d5416db68..fa542f50d79b81c9e696ff04a401a7dfb017f073 100644 (file)
@@ -278,6 +278,12 @@ void mite_release_channel(struct mite_channel *mite_chan)
        comedi_spin_lock_irqsave(&mite->lock, flags);
        if(mite->channel_allocated[mite_chan->channel])
        {
+               // disable all channel's interrupts
+               writel(CHCR_CLR_DMA_IE | CHCR_CLR_LINKP_IE |
+                       CHCR_CLR_SAR_IE | CHCR_CLR_DONE_IE |
+                       CHCR_CLR_MRDY_IE | CHCR_CLR_DRDY_IE |
+                       CHCR_CLR_LC_IE | CHCR_CLR_CONT_RB_IE,
+                       mite->mite_io_addr + MITE_CHCR(mite_chan->channel));
                mite_dma_disarm(mite_chan);
                mite_dma_reset(mite_chan);
                mite->channel_allocated[mite_chan->channel] = 0;
@@ -575,9 +581,11 @@ int mite_sync_output_dma(struct mite_channel *mite_chan, comedi_async *async)
        {
                return 0;
        }
-       comedi_buf_read_free(async, count);
-
-       async->events |= COMEDI_CB_BLOCK;
+       if(count)
+       {
+               comedi_buf_read_free(async, count);
+               async->events |= COMEDI_CB_BLOCK;
+       }
        return 0;
 }