diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2015-02-24 06:32:11 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-02-24 09:43:34 -0500 |
commit | ea11370fffdfedbd0cca0fce17907d2c993246bc (patch) | |
tree | f21a1e072b1f238c2ce5ed30c8d820c82b69d428 /drivers/spi | |
parent | 39bc03bfecab38e7532449d54aeef3db817084af (diff) |
spi: dw: get TX level without an additional variable
There is no need to have an additional variable to get a TX level. The patch
refactors this piece of code.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-dw.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 29157f00f45a..0febb97ae32f 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c | |||
@@ -365,7 +365,7 @@ static void pump_transfers(unsigned long data) | |||
365 | u8 bits = 0; | 365 | u8 bits = 0; |
366 | u8 imask = 0; | 366 | u8 imask = 0; |
367 | u8 cs_change = 0; | 367 | u8 cs_change = 0; |
368 | u16 txint_level = 0; | 368 | u16 txlevel = 0; |
369 | u16 clk_div = 0; | 369 | u16 clk_div = 0; |
370 | u32 speed = 0; | 370 | u32 speed = 0; |
371 | u32 cr0 = 0; | 371 | u32 cr0 = 0; |
@@ -461,10 +461,7 @@ static void pump_transfers(unsigned long data) | |||
461 | * we only need set the TXEI IRQ, as TX/RX always happen syncronizely | 461 | * we only need set the TXEI IRQ, as TX/RX always happen syncronizely |
462 | */ | 462 | */ |
463 | if (!dws->dma_mapped && !chip->poll_mode) { | 463 | if (!dws->dma_mapped && !chip->poll_mode) { |
464 | int templen = dws->len / dws->n_bytes; | 464 | txlevel = min_t(u16, dws->fifo_len / 2, dws->len / dws->n_bytes); |
465 | |||
466 | txint_level = dws->fifo_len / 2; | ||
467 | txint_level = (templen > txint_level) ? txint_level : templen; | ||
468 | 465 | ||
469 | imask |= SPI_INT_TXEI | SPI_INT_TXOI | | 466 | imask |= SPI_INT_TXEI | SPI_INT_TXOI | |
470 | SPI_INT_RXUI | SPI_INT_RXOI; | 467 | SPI_INT_RXUI | SPI_INT_RXOI; |
@@ -490,8 +487,8 @@ static void pump_transfers(unsigned long data) | |||
490 | spi_mask_intr(dws, 0xff); | 487 | spi_mask_intr(dws, 0xff); |
491 | if (imask) | 488 | if (imask) |
492 | spi_umask_intr(dws, imask); | 489 | spi_umask_intr(dws, imask); |
493 | if (txint_level) | 490 | if (txlevel) |
494 | dw_writew(dws, DW_SPI_TXFLTR, txint_level); | 491 | dw_writew(dws, DW_SPI_TXFLTR, txlevel); |
495 | 492 | ||
496 | spi_enable_chip(dws, 1); | 493 | spi_enable_chip(dws, 1); |
497 | } | 494 | } |