Title: [6728] trunk/drivers/char/bfin-dma.c: allow people to interrupt a sync transfer
- Revision
- 6728
- Author
- vapier
- Date
- 2009-06-15 07:50:02 -0500 (Mon, 15 Jun 2009)
Log Message
allow people to interrupt a sync transfer
Modified Paths
Diff
Modified: trunk/drivers/char/bfin-dma.c (6727 => 6728)
--- trunk/drivers/char/bfin-dma.c 2009-06-15 11:52:12 UTC (rev 6727)
+++ trunk/drivers/char/bfin-dma.c 2009-06-15 12:50:02 UTC (rev 6728)
@@ -217,9 +217,9 @@
enable_dma(state->chan_dst);
if (!async)
- wait_for_completion(&state->c);
-
- return 0;
+ return wait_for_completion_interruptible(&state->c);
+ else
+ return 0;
}
/**
@@ -255,11 +255,25 @@
return -EFAULT;
}
+ /* The get/put module business is to make sure we don't let the
+ * module be unloaded while holding a dma channel.
+ */
switch (cmd) {
case BF_DMA_RUN:
- case BF_DMA_ARUN: return bdi_do_dma(state, cmd == BF_DMA_ARUN);
- case BF_DMA_REQUEST: return bdi_request_dma(state, ustate);
- case BF_DMA_FREE: return bdi_free_dma(state);
+ case BF_DMA_ARUN:
+ return bdi_do_dma(state, cmd == BF_DMA_ARUN);
+
+ case BF_DMA_REQUEST:
+ if (!try_module_get(filp->f_op->owner))
+ return -EAGAIN;
+ ret = bdi_request_dma(state, ustate);
+ if (ret)
+ module_put(filp->f_op->owner);
+ return ret;
+
+ case BF_DMA_FREE:
+ module_put(filp->f_op->owner);
+ return bdi_free_dma(state);
}
return -EINVAL;
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits