Skip to content

Commit 4fdc03a

Browse files
fancerbroonie
authored andcommitted
spi: dw: Discard dma_width member of the dw_spi structure
This member has exactly the same value as n_bytes of the DW SPI private data object, it's calculated at the same point of the transfer method, n_bytes isn't changed during the whole transfer, and they even serve for the same purpose - keep number of bytes per transfer word, though the dma_width is used only to calculate the DMA source/destination addresses width, which n_bytes could be also utilized for. Taking all of these into account let's replace the dma_width member usage with n_bytes one and remove the former. Signed-off-by: Serge Semin <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Cc: Georgy Vlasov <[email protected]> Cc: Ramil Zaripov <[email protected]> Cc: Alexey Malahov <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: Paul Burton <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Rob Herring <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 595c19d commit 4fdc03a

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

drivers/spi/spi-dw-mid.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ static bool mid_spi_can_dma(struct spi_controller *master,
133133
return xfer->len > dws->fifo_len;
134134
}
135135

136-
static enum dma_slave_buswidth convert_dma_width(u32 dma_width) {
137-
if (dma_width == 1)
136+
static enum dma_slave_buswidth convert_dma_width(u8 n_bytes) {
137+
if (n_bytes == 1)
138138
return DMA_SLAVE_BUSWIDTH_1_BYTE;
139-
else if (dma_width == 2)
139+
else if (n_bytes == 2)
140140
return DMA_SLAVE_BUSWIDTH_2_BYTES;
141141

142142
return DMA_SLAVE_BUSWIDTH_UNDEFINED;
@@ -172,7 +172,7 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_tx(struct dw_spi *dws,
172172
txconf.dst_addr = dws->dma_addr;
173173
txconf.dst_maxburst = 16;
174174
txconf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
175-
txconf.dst_addr_width = convert_dma_width(dws->dma_width);
175+
txconf.dst_addr_width = convert_dma_width(dws->n_bytes);
176176
txconf.device_fc = false;
177177

178178
dmaengine_slave_config(dws->txchan, &txconf);
@@ -221,7 +221,7 @@ static struct dma_async_tx_descriptor *dw_spi_dma_prepare_rx(struct dw_spi *dws,
221221
rxconf.src_addr = dws->dma_addr;
222222
rxconf.src_maxburst = 16;
223223
rxconf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
224-
rxconf.src_addr_width = convert_dma_width(dws->dma_width);
224+
rxconf.src_addr_width = convert_dma_width(dws->n_bytes);
225225
rxconf.device_fc = false;
226226

227227
dmaengine_slave_config(dws->rxchan, &rxconf);

drivers/spi/spi-dw.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ static int dw_spi_transfer_one(struct spi_controller *master,
353353
}
354354

355355
dws->n_bytes = DIV_ROUND_UP(transfer->bits_per_word, BITS_PER_BYTE);
356-
dws->dma_width = DIV_ROUND_UP(transfer->bits_per_word, BITS_PER_BYTE);
357356

358357
cr0 = dws->update_cr0(master, spi, transfer);
359358
dw_writel(dws, DW_SPI_CTRLR0, cr0);

drivers/spi/spi-dw.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ struct dw_spi {
136136
void *rx_end;
137137
int dma_mapped;
138138
u8 n_bytes; /* current is a 1/2 bytes op */
139-
u32 dma_width;
140139
irqreturn_t (*transfer_handler)(struct dw_spi *dws);
141140
u32 current_freq; /* frequency in hz */
142141

0 commit comments

Comments
 (0)