/* sh_dma_free_chan_resources - Free all resources of the channel.  */
static void sh_dmae_free_chan_resources(struct dma_chan *chan)
/* sh_dma_free_chan_resources - Free all resources of the channel.  */
static void sh_dmae_free_chan_resources(struct dma_chan *chan)
{
	struct sh_dmae_chan *sh_chan = to_sh_chan(chan);
	struct sh_desc *desc, *_desc;
	LIST_HEAD(list);
	if (!list_empty(&sh_chan->ld_queue))
		sh_dmae_chan_ld_cleanup(sh_chan, true);
	spin_lock_bh(&sh_chan->desc_lock);
	list_splice_init(&sh_chan->ld_free, &list);
	sh_chan->descs_allocated = 0;
	spin_unlock_bh(&sh_chan->desc_lock);
	list_for_each_entry_safe(desc, _desc, &list, node)
		kfree(desc);
}