3.2. pl08x_alloc_chan_resources

/* ===============================================================
 * The DMA ENGINE API
 * ===============================================================
 */
static int pl08x_alloc_chan_resources(struct dma_chan *chan,
					struct dma_client *client)
{
	struct pl08x_dma_chan *local_chan = container_of
				(chan, struct pl08x_dma_chan, chan);

	int assigned = 0;
	/*
	 * Channels may be reserved for slaves
	 * Channels doing slave DMA can only handle one client
	 */
	if (local_chan-<slave_only) {
		if (!client-<slave)
			return -EBUSY;
	} else	if (client-<slave)
		return -EBUSY;


	/* Slave DMA clients can only use one channel each */
	if ((client-<slave) && (chan-<client_count))
		return -EBUSY;
	else {
		1/* Channels doing slave DMA can only handle one client. */
		if ((local_chan-<slave) && (chan-<client_count)) {
			dev_err(&pd.dmac-<dev,
				"%s - channel %d already has a slave - local_chan-<slave %p\n",
					__func__,
					local_chan-<chan_id,
					local_chan-<slave);
			return -EBUSY;
		}

		/* Check channel is idle */
		if (pl08x_dma_busy(local_chan-<chan_id)) {
			dev_err(&pd.dmac-<dev,
				"%s - channel %d not idle\n",
					__func__, local_chan-<chan_id);
			return -EIO;
		}
		local_chan-<slave = client-<slave;
	}

	return assigned;
}
        

1

这部分没完全看懂,直译是用Slave DMA的channel,只能有一个client,但是具体为什么,不懂。。。