[PATCH 1/1 RFC] dmaengine: bcm2835: Remove redundant info from channel info

Alexander Stein alexanders83 at web.de
Tue Mar 24 13:37:42 PDT 2015


There is no need to store the DREQ channel additionally in the channel
structure. This information is already stored in struct dma_slave_config
which is setup by bcm2835_dma_xlate.

Signed-off-by: Alexander Stein <alexanders83 at web.de>
---
I compared this driver with the Raspberry Pi foundation kernel and noticed
they set dreq from cfg.slave_id in their bcm2835_dma_prep_slave_sg.
Finding out why they do, I come to the conclusion the channel ID in slave_id
and dreq must be the same each time, even after bcm2835_dma_slave_config has
been called, AFAICS the only position c->cfg is set.
So we can remove the redundant storage.

 drivers/dma/bcm2835-dma.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
index 0723096..6478dc6 100644
--- a/drivers/dma/bcm2835-dma.c
+++ b/drivers/dma/bcm2835-dma.c
@@ -68,7 +68,6 @@ struct bcm2835_chan {
 
 	struct dma_slave_config	cfg;
 	bool cyclic;
-	unsigned int dreq;
 
 	int ch;
 	struct bcm2835_desc *desc;
@@ -415,9 +414,9 @@ static struct dma_async_tx_descriptor *bcm2835_dma_prep_dma_cyclic(
 			control_block->info |= sync_type;
 
 		/* Setup DREQ channel */
-		if (c->dreq != 0)
+		if (c->cfg.slave_id != 0)
 			control_block->info |=
-				BCM2835_DMA_PER_MAP(c->dreq);
+				BCM2835_DMA_PER_MAP(c->cfg.slave_id);
 
 		/* Length of a frame */
 		control_block->length = period_len;
@@ -545,7 +544,7 @@ static struct dma_chan *bcm2835_dma_xlate(struct of_phandle_args *spec,
 		return NULL;
 
 	/* Set DREQ from param */
-	to_bcm2835_dma_chan(chan)->dreq = spec->args[0];
+	to_bcm2835_dma_chan(chan)->cfg.slave_id = spec->args[0];
 
 	return chan;
 }
-- 
2.3.3




More information about the linux-rpi-kernel mailing list