Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b314196 authored by Timur Tabi's avatar Timur Tabi Committed by Dan Williams
Browse files

dmatest: properly handle duplicate DMA channels



Update the the dmatest driver so that it handles duplicate DMA channels
properly.

When a DMA client is notified of an available DMA channel, it must check if it
has already allocated resources for that channel.  If so, it should return
DMA_DUP.  This can happen, for example, if a DMA driver calls
dma_async_device_register() more than once.

Acked-by: default avatarHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
Signed-off-by: default avatarTimur Tabi <timur@freescale.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 89f72a06
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -325,6 +325,11 @@ static enum dma_state_client dmatest_add_channel(struct dma_chan *chan)
	struct dmatest_thread	*thread;
	struct dmatest_thread	*thread;
	unsigned int		i;
	unsigned int		i;


	/* Have we already been told about this channel? */
	list_for_each_entry(dtc, &dmatest_channels, node)
		if (dtc->chan == chan)
			return DMA_DUP;

	dtc = kmalloc(sizeof(struct dmatest_chan), GFP_ATOMIC);
	dtc = kmalloc(sizeof(struct dmatest_chan), GFP_ATOMIC);
	if (!dtc) {
	if (!dtc) {
		pr_warning("dmatest: No memory for %s\n", chan->dev.bus_id);
		pr_warning("dmatest: No memory for %s\n", chan->dev.bus_id);