Commit 3a92063b authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Vinod Koul
Browse files

dmaengine: Use negative condition for better readability



When negative condition is in use we may decrease indentation level
and make the main part of logic better visible.

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20200226101842.29426-2-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 88ac039c
Loading
Loading
Loading
Loading
+18 −17
Original line number Diff line number Diff line
@@ -618,11 +618,12 @@ static inline void dmaengine_unmap_put(struct dmaengine_unmap_data *unmap)

static inline void dma_descriptor_unmap(struct dma_async_tx_descriptor *tx)
{
	if (tx->unmap) {
	if (!tx->unmap)
		return;

	dmaengine_unmap_put(tx->unmap);
	tx->unmap = NULL;
}
}

#ifndef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH
static inline void txd_lock(struct dma_async_tx_descriptor *txd)
@@ -1408,12 +1409,13 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
static inline void
dma_set_tx_state(struct dma_tx_state *st, dma_cookie_t last, dma_cookie_t used, u32 residue)
{
	if (st) {
	if (!st)
		return;

	st->last = last;
	st->used = used;
	st->residue = residue;
}
}

#ifdef CONFIG_DMA_ENGINE
struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type);
@@ -1489,12 +1491,11 @@ static inline int dmaengine_desc_set_reuse(struct dma_async_tx_descriptor *tx)
	if (ret)
		return ret;

	if (caps.descriptor_reuse) {
	if (!caps.descriptor_reuse)
		return -EPERM;

	tx->flags |= DMA_CTRL_REUSE;
	return 0;
	} else {
		return -EPERM;
	}
}

static inline void dmaengine_desc_clear_reuse(struct dma_async_tx_descriptor *tx)
@@ -1510,10 +1511,10 @@ static inline bool dmaengine_desc_test_reuse(struct dma_async_tx_descriptor *tx)
static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc)
{
	/* this is supported for reusable desc, so check that */
	if (dmaengine_desc_test_reuse(desc))
		return desc->desc_free(desc);
	else
	if (!dmaengine_desc_test_reuse(desc))
		return -EPERM;

	return desc->desc_free(desc);
}

/* --- DMA device --- */