summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-rockchip.c
diff options
context:
space:
mode:
authorEmil Renner Berthing <kernel@esmil.dk>2018-10-31 06:56:59 -0400
committerMark Brown <broonie@kernel.org>2018-11-05 06:41:50 -0500
commit31bcb57be12fd815a9051f07d64334809b8cb472 (patch)
tree76f8a7605590733b1cd046f79f4d72d98b763e25 /drivers/spi/spi-rockchip.c
parent30688e4e670d21126aa596df4523940e2f8d24de (diff)
spi: rockchip: use designated init for dma config
Use C99 designated initializers for dma slave config structures. This also makes sure uninitialized fields are zeroed so we don't need an explicit memset. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-rockchip.c')
-rw-r--r--drivers/spi/spi-rockchip.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 7e54e1a69cc8..87d1b9837d94 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -442,12 +442,8 @@ static void rockchip_spi_dma_txcb(void *data)
442static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) 442static int rockchip_spi_prepare_dma(struct rockchip_spi *rs)
443{ 443{
444 unsigned long flags; 444 unsigned long flags;
445 struct dma_slave_config rxconf, txconf;
446 struct dma_async_tx_descriptor *rxdesc, *txdesc; 445 struct dma_async_tx_descriptor *rxdesc, *txdesc;
447 446
448 memset(&rxconf, 0, sizeof(rxconf));
449 memset(&txconf, 0, sizeof(txconf));
450
451 spin_lock_irqsave(&rs->lock, flags); 447 spin_lock_irqsave(&rs->lock, flags);
452 rs->state &= ~RXBUSY; 448 rs->state &= ~RXBUSY;
453 rs->state &= ~TXBUSY; 449 rs->state &= ~TXBUSY;
@@ -455,10 +451,13 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs)
455 451
456 rxdesc = NULL; 452 rxdesc = NULL;
457 if (rs->rx) { 453 if (rs->rx) {
458 rxconf.direction = DMA_DEV_TO_MEM; 454 struct dma_slave_config rxconf = {
459 rxconf.src_addr = rs->dma_rx.addr; 455 .direction = DMA_DEV_TO_MEM,
460 rxconf.src_addr_width = rs->n_bytes; 456 .src_addr = rs->dma_rx.addr,
461 rxconf.src_maxburst = 1; 457 .src_addr_width = rs->n_bytes,
458 .src_maxburst = 1,
459 };
460
462 dmaengine_slave_config(rs->dma_rx.ch, &rxconf); 461 dmaengine_slave_config(rs->dma_rx.ch, &rxconf);
463 462
464 rxdesc = dmaengine_prep_slave_sg( 463 rxdesc = dmaengine_prep_slave_sg(
@@ -474,10 +473,13 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs)
474 473
475 txdesc = NULL; 474 txdesc = NULL;
476 if (rs->tx) { 475 if (rs->tx) {
477 txconf.direction = DMA_MEM_TO_DEV; 476 struct dma_slave_config txconf = {
478 txconf.dst_addr = rs->dma_tx.addr; 477 .direction = DMA_MEM_TO_DEV,
479 txconf.dst_addr_width = rs->n_bytes; 478 .dst_addr = rs->dma_tx.addr,
480 txconf.dst_maxburst = rs->fifo_len / 2; 479 .dst_addr_width = rs->n_bytes,
480 .dst_maxburst = rs->fifo_len / 2,
481 };
482
481 dmaengine_slave_config(rs->dma_tx.ch, &txconf); 483 dmaengine_slave_config(rs->dma_tx.ch, &txconf);
482 484
483 txdesc = dmaengine_prep_slave_sg( 485 txdesc = dmaengine_prep_slave_sg(