Commit c1b00674 authored by Tudor Ambarus's avatar Tudor Ambarus Committed by Mark Brown

spi: atmel: Drop slave_config argument in atmel_spi_dma_slave_config()

The callers passed a pointer to slave_config as an argument of
atmel_spi_dma_slave_config(), but they did not use it afterwards.
Use instead a local variable in atmel_spi_dma_slave_config(), and
stop passing arguments that are not needed in the callers.
Signed-off-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/r/20211125124110.838037-2-tudor.ambarus@microchip.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent e10a6bb5
...@@ -433,26 +433,25 @@ static bool atmel_spi_can_dma(struct spi_master *master, ...@@ -433,26 +433,25 @@ static bool atmel_spi_can_dma(struct spi_master *master,
} }
static int atmel_spi_dma_slave_config(struct atmel_spi *as, static int atmel_spi_dma_slave_config(struct atmel_spi *as, u8 bits_per_word)
struct dma_slave_config *slave_config,
u8 bits_per_word)
{ {
struct spi_master *master = platform_get_drvdata(as->pdev); struct spi_master *master = platform_get_drvdata(as->pdev);
struct dma_slave_config slave_config;
int err = 0; int err = 0;
if (bits_per_word > 8) { if (bits_per_word > 8) {
slave_config->dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
slave_config->src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
} else { } else {
slave_config->dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
slave_config->src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
} }
slave_config->dst_addr = (dma_addr_t)as->phybase + SPI_TDR; slave_config.dst_addr = (dma_addr_t)as->phybase + SPI_TDR;
slave_config->src_addr = (dma_addr_t)as->phybase + SPI_RDR; slave_config.src_addr = (dma_addr_t)as->phybase + SPI_RDR;
slave_config->src_maxburst = 1; slave_config.src_maxburst = 1;
slave_config->dst_maxburst = 1; slave_config.dst_maxburst = 1;
slave_config->device_fc = false; slave_config.device_fc = false;
/* /*
* This driver uses fixed peripheral select mode (PS bit set to '0' in * This driver uses fixed peripheral select mode (PS bit set to '0' in
...@@ -468,8 +467,8 @@ static int atmel_spi_dma_slave_config(struct atmel_spi *as, ...@@ -468,8 +467,8 @@ static int atmel_spi_dma_slave_config(struct atmel_spi *as,
* So we'd rather write only one data at the time. Hence the transmit * So we'd rather write only one data at the time. Hence the transmit
* path works the same whether FIFOs are available (and enabled) or not. * path works the same whether FIFOs are available (and enabled) or not.
*/ */
slave_config->direction = DMA_MEM_TO_DEV; slave_config.direction = DMA_MEM_TO_DEV;
if (dmaengine_slave_config(master->dma_tx, slave_config)) { if (dmaengine_slave_config(master->dma_tx, &slave_config)) {
dev_err(&as->pdev->dev, dev_err(&as->pdev->dev,
"failed to configure tx dma channel\n"); "failed to configure tx dma channel\n");
err = -EINVAL; err = -EINVAL;
...@@ -483,8 +482,8 @@ static int atmel_spi_dma_slave_config(struct atmel_spi *as, ...@@ -483,8 +482,8 @@ static int atmel_spi_dma_slave_config(struct atmel_spi *as,
* So the receive path works the same whether FIFOs are available (and * So the receive path works the same whether FIFOs are available (and
* enabled) or not. * enabled) or not.
*/ */
slave_config->direction = DMA_DEV_TO_MEM; slave_config.direction = DMA_DEV_TO_MEM;
if (dmaengine_slave_config(master->dma_rx, slave_config)) { if (dmaengine_slave_config(master->dma_rx, &slave_config)) {
dev_err(&as->pdev->dev, dev_err(&as->pdev->dev,
"failed to configure rx dma channel\n"); "failed to configure rx dma channel\n");
err = -EINVAL; err = -EINVAL;
...@@ -496,7 +495,6 @@ static int atmel_spi_dma_slave_config(struct atmel_spi *as, ...@@ -496,7 +495,6 @@ static int atmel_spi_dma_slave_config(struct atmel_spi *as,
static int atmel_spi_configure_dma(struct spi_master *master, static int atmel_spi_configure_dma(struct spi_master *master,
struct atmel_spi *as) struct atmel_spi *as)
{ {
struct dma_slave_config slave_config;
struct device *dev = &as->pdev->dev; struct device *dev = &as->pdev->dev;
int err; int err;
...@@ -518,7 +516,7 @@ static int atmel_spi_configure_dma(struct spi_master *master, ...@@ -518,7 +516,7 @@ static int atmel_spi_configure_dma(struct spi_master *master,
goto error; goto error;
} }
err = atmel_spi_dma_slave_config(as, &slave_config, 8); err = atmel_spi_dma_slave_config(as, 8);
if (err) if (err)
goto error; goto error;
...@@ -700,7 +698,6 @@ static int atmel_spi_next_xfer_dma_submit(struct spi_master *master, ...@@ -700,7 +698,6 @@ static int atmel_spi_next_xfer_dma_submit(struct spi_master *master,
struct dma_chan *txchan = master->dma_tx; struct dma_chan *txchan = master->dma_tx;
struct dma_async_tx_descriptor *rxdesc; struct dma_async_tx_descriptor *rxdesc;
struct dma_async_tx_descriptor *txdesc; struct dma_async_tx_descriptor *txdesc;
struct dma_slave_config slave_config;
dma_cookie_t cookie; dma_cookie_t cookie;
dev_vdbg(master->dev.parent, "atmel_spi_next_xfer_dma_submit\n"); dev_vdbg(master->dev.parent, "atmel_spi_next_xfer_dma_submit\n");
...@@ -712,8 +709,7 @@ static int atmel_spi_next_xfer_dma_submit(struct spi_master *master, ...@@ -712,8 +709,7 @@ static int atmel_spi_next_xfer_dma_submit(struct spi_master *master,
*plen = xfer->len; *plen = xfer->len;
if (atmel_spi_dma_slave_config(as, &slave_config, if (atmel_spi_dma_slave_config(as, xfer->bits_per_word))
xfer->bits_per_word))
goto err_exit; goto err_exit;
/* Send both scatterlists */ /* Send both scatterlists */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment