aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-dw.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2014-09-13 12:03:05 -0400
committerMark Brown <broonie@kernel.org>2014-09-13 12:03:05 -0400
commit551f6a58d496a99702088ac762f247e04d8bfff9 (patch)
tree95610bb3eae95bd98d1c80bcd161be67c33a81f7 /drivers/spi/spi-dw.c
parent197e96b4d80554a66aff34df5406b4c2d26f0111 (diff)
parenta2cea9831e7df2bd21ade3c02be4a94146e1645b (diff)
Merge branch 'topic/checkpatch' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into spi-dw
Diffstat (limited to 'drivers/spi/spi-dw.c')
-rw-r--r--drivers/spi/spi-dw.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index 6e55334c239a..fdb5a6d1c8c6 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -131,8 +131,7 @@ static int mrst_spi_debugfs_init(struct dw_spi *dws)
131 131
132static void mrst_spi_debugfs_remove(struct dw_spi *dws) 132static void mrst_spi_debugfs_remove(struct dw_spi *dws)
133{ 133{
134 if (dws->debugfs) 134 debugfs_remove_recursive(dws->debugfs);
135 debugfs_remove_recursive(dws->debugfs);
136} 135}
137 136
138#else 137#else
@@ -173,7 +172,7 @@ static inline u32 rx_max(struct dw_spi *dws)
173{ 172{
174 u32 rx_left = (dws->rx_end - dws->rx) / dws->n_bytes; 173 u32 rx_left = (dws->rx_end - dws->rx) / dws->n_bytes;
175 174
176 return min(rx_left, (u32)dw_readw(dws, DW_SPI_RXFLR)); 175 return min_t(u32, rx_left, dw_readw(dws, DW_SPI_RXFLR));
177} 176}
178 177
179static void dw_writer(struct dw_spi *dws) 178static void dw_writer(struct dw_spi *dws)
@@ -224,8 +223,9 @@ static void *next_transfer(struct dw_spi *dws)
224 struct spi_transfer, 223 struct spi_transfer,
225 transfer_list); 224 transfer_list);
226 return RUNNING_STATE; 225 return RUNNING_STATE;
227 } else 226 }
228 return DONE_STATE; 227
228 return DONE_STATE;
229} 229}
230 230
231/* 231/*
@@ -467,10 +467,12 @@ static void pump_transfers(unsigned long data)
467 */ 467 */
468 if (!dws->dma_mapped && !chip->poll_mode) { 468 if (!dws->dma_mapped && !chip->poll_mode) {
469 int templen = dws->len / dws->n_bytes; 469 int templen = dws->len / dws->n_bytes;
470
470 txint_level = dws->fifo_len / 2; 471 txint_level = dws->fifo_len / 2;
471 txint_level = (templen > txint_level) ? txint_level : templen; 472 txint_level = (templen > txint_level) ? txint_level : templen;
472 473
473 imask |= SPI_INT_TXEI | SPI_INT_TXOI | SPI_INT_RXUI | SPI_INT_RXOI; 474 imask |= SPI_INT_TXEI | SPI_INT_TXOI |
475 SPI_INT_RXUI | SPI_INT_RXOI;
474 dws->transfer_handler = interrupt_transfer; 476 dws->transfer_handler = interrupt_transfer;
475 } 477 }
476 478
@@ -511,7 +513,6 @@ static void pump_transfers(unsigned long data)
511 513
512early_exit: 514early_exit:
513 giveback(dws); 515 giveback(dws);
514 return;
515} 516}
516 517
517static int dw_spi_transfer_one_message(struct spi_master *master, 518static int dw_spi_transfer_one_message(struct spi_master *master,
@@ -615,6 +616,7 @@ static void spi_hw_init(struct dw_spi *dws)
615 */ 616 */
616 if (!dws->fifo_len) { 617 if (!dws->fifo_len) {
617 u32 fifo; 618 u32 fifo;
619
618 for (fifo = 2; fifo <= 257; fifo++) { 620 for (fifo = 2; fifo <= 257; fifo++) {
619 dw_writew(dws, DW_SPI_TXFLTR, fifo); 621 dw_writew(dws, DW_SPI_TXFLTR, fifo);
620 if (fifo != dw_readw(dws, DW_SPI_TXFLTR)) 622 if (fifo != dw_readw(dws, DW_SPI_TXFLTR))