From 116a5ae782199fea4d3ae964636e04a99132c905 Mon Sep 17 00:00:00 2001 From: Emil Renner Berthing Date: Wed, 31 Oct 2018 11:56:59 +0100 Subject: [PATCH] UPSTREAM: 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. Change-Id: I306513287454ca38db8dde680a57ebec82965395 Signed-off-by: Emil Renner Berthing Tested-by: Heiko Stuebner Signed-off-by: Mark Brown Signed-off-by: Jon Lin (cherry picked from commit 31bcb57be12fd815a9051f07d64334809b8cb472) --- drivers/spi/spi-rockchip.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 3d20148bb7d7..45b51ffd2cbe 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -463,12 +463,8 @@ static u32 rockchip_spi_calc_burst_size(u32 data_len) static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) { unsigned long flags; - struct dma_slave_config rxconf, txconf; struct dma_async_tx_descriptor *rxdesc, *txdesc; - memset(&rxconf, 0, sizeof(rxconf)); - memset(&txconf, 0, sizeof(txconf)); - spin_lock_irqsave(&rs->lock, flags); rs->state &= ~RXBUSY; rs->state &= ~TXBUSY; @@ -476,11 +472,14 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) rxdesc = NULL; if (rs->rx) { - rxconf.direction = DMA_DEV_TO_MEM; - rxconf.src_addr = rs->dma_rx.addr; - rxconf.src_addr_width = rs->n_bytes; - rxconf.src_maxburst = rockchip_spi_calc_burst_size(rs->len / - rs->n_bytes); + struct dma_slave_config rxconf = { + .direction = DMA_DEV_TO_MEM, + .src_addr = rs->dma_rx.addr, + .src_addr_width = rs->n_bytes, + .src_maxburst = rockchip_spi_calc_burst_size(rs->len / + rs->n_bytes), + }; + dmaengine_slave_config(rs->dma_rx.ch, &rxconf); rxdesc = dmaengine_prep_slave_sg( @@ -496,10 +495,13 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) txdesc = NULL; if (rs->tx) { - txconf.direction = DMA_MEM_TO_DEV; - txconf.dst_addr = rs->dma_tx.addr; - txconf.dst_addr_width = rs->n_bytes; - txconf.dst_maxburst = 8; + struct dma_slave_config txconf = { + .direction = DMA_MEM_TO_DEV, + .dst_addr = rs->dma_tx.addr, + .dst_addr_width = rs->n_bytes, + .dst_maxburst = 8, + }; + dmaengine_slave_config(rs->dma_tx.ch, &txconf); txdesc = dmaengine_prep_slave_sg(