diff options
Diffstat (limited to 'drivers/spi/spi-dw.c')
-rw-r--r-- | drivers/spi/spi-dw.c | 16 |
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 | ||
132 | static void mrst_spi_debugfs_remove(struct dw_spi *dws) | 132 | static 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 | ||
179 | static void dw_writer(struct dw_spi *dws) | 178 | static 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 | ||
512 | early_exit: | 514 | early_exit: |
513 | giveback(dws); | 515 | giveback(dws); |
514 | return; | ||
515 | } | 516 | } |
516 | 517 | ||
517 | static int dw_spi_transfer_one_message(struct spi_master *master, | 518 | static 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)) |