diff mbox

[1/3] spi: dw-mid: change magic numbers to the constants

Message ID 1412256669-14828-1-git-send-email-andriy.shevchenko@linux.intel.com (mailing list archive)
State Accepted
Commit 15ee3be78b017ee9d697fe59d45cdfbb35d9fdeb
Headers show

Commit Message

Andy Shevchenko Oct. 2, 2014, 1:31 p.m. UTC
Instead of using magic numbers in the code we create a bit map definition of
the DMACR register and use it.

There is no functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/spi/spi-dw-mid.c | 4 ++--
 drivers/spi/spi-dw.h     | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

Mark Brown Oct. 2, 2014, 4:06 p.m. UTC | #1
On Thu, Oct 02, 2014 at 04:31:07PM +0300, Andy Shevchenko wrote:
> Instead of using magic numbers in the code we create a bit map definition of
> the DMACR register and use it.

Applied all, thanks.
diff mbox

Patch

diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c
index ecae30f..7bdf937 100644
--- a/drivers/spi/spi-dw-mid.c
+++ b/drivers/spi/spi-dw-mid.c
@@ -124,9 +124,9 @@  static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)
 		dw_writew(dws, DW_SPI_DMARDLR, 0xf);
 		dw_writew(dws, DW_SPI_DMATDLR, 0x10);
 		if (dws->tx_dma)
-			dma_ctrl |= 0x2;
+			dma_ctrl |= SPI_DMA_TDMAE;
 		if (dws->rx_dma)
-			dma_ctrl |= 0x1;
+			dma_ctrl |= SPI_DMA_RDMAE;
 		dw_writew(dws, DW_SPI_DMACR, dma_ctrl);
 		spi_enable_chip(dws, 1);
 	}
diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h
index 089fc4b..83a103a 100644
--- a/drivers/spi/spi-dw.h
+++ b/drivers/spi/spi-dw.h
@@ -74,6 +74,10 @@ 
 #define SPI_INT_RXFI			(1 << 4)
 #define SPI_INT_MSTI			(1 << 5)
 
+/* Bit fields in DMACR */
+#define SPI_DMA_RDMAE			(1 << 0)
+#define SPI_DMA_TDMAE			(1 << 1)
+
 /* TX RX interrupt level threshold, max can be 256 */
 #define SPI_INT_THRESHOLD		32