/* Gets the next descriptor from the chain, and must be called with the channel's desc_lock held. Allocates more descriptors if the channel has run out.  */
static struct ioat_desc_sw* ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat)
/* Gets the next descriptor from the chain, and must be called with the channel's desc_lock held. Allocates more descriptors if the channel has run out.  */
static struct ioat_desc_sw* ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat)
{
	struct ioat_desc_sw *new;
	if (!list_empty(&ioat->free_desc)) {
		new = to_ioat_desc(ioat->free_desc.next);
		list_del(&new->node);
	} else {
		new = ioat_dma_alloc_descriptor(ioat, GFP_ATOMIC);
		if (!new) {
			dev_err(to_dev(&ioat->base), "alloc failed\n");
			return NULL;
		}
	}
	dev_dbg(to_dev(&ioat->base), "%s: allocated: %d\n",
		__func__, desc_id(new));
	prefetch(new->hw);
	return new;
}