From 77bbb077491c5e3faea52a28a225d53f8a643a1b Mon Sep 17 00:00:00 2001 From: Juha Niskanen Date: Sat, 31 Oct 2020 17:46:33 +0200 Subject: [PATCH] arch: imxrt, s32k1xx, stm32f7 spi: fix CONFIG_SPI_BITORDER build errors Signed-off-by: Juha Niskanen --- arch/arm/src/imxrt/imxrt_lpspi.c | 3 +-- arch/arm/src/s32k1xx/s32k1xx_lpspi.c | 3 +-- arch/arm/src/stm32f7/stm32_spi.c | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/arch/arm/src/imxrt/imxrt_lpspi.c b/arch/arm/src/imxrt/imxrt_lpspi.c index 84448820c4..c65742005a 100644 --- a/arch/arm/src/imxrt/imxrt_lpspi.c +++ b/arch/arm/src/imxrt/imxrt_lpspi.c @@ -1187,7 +1187,6 @@ static int imxrt_lpspi_hwfeatures(FAR struct spi_dev_s *dev, FAR struct imxrt_lpspidev_s *priv = (FAR struct imxrt_lpspidev_s *)dev; uint32_t setbits; uint32_t clrbits; - int savbits = nbits; spiinfo("features=%08x\n", features); @@ -1204,7 +1203,7 @@ static int imxrt_lpspi_hwfeatures(FAR struct spi_dev_s *dev, clrbits = LPSPI_TCR_LSBF; } - imxrt_lpspi_modigyreg32(priv, IMXRT_LPSPI_TCR_OFFSET, clrbits, setbits); + imxrt_lpspi_modifyreg32(priv, IMXRT_LPSPI_TCR_OFFSET, clrbits, setbits); /* Other H/W features are not supported */ diff --git a/arch/arm/src/s32k1xx/s32k1xx_lpspi.c b/arch/arm/src/s32k1xx/s32k1xx_lpspi.c index e601613125..5ce449d3f5 100644 --- a/arch/arm/src/s32k1xx/s32k1xx_lpspi.c +++ b/arch/arm/src/s32k1xx/s32k1xx_lpspi.c @@ -1147,7 +1147,6 @@ static int s32k1xx_lpspi_hwfeatures(FAR struct spi_dev_s *dev, FAR struct s32k1xx_lpspidev_s *priv = (FAR struct s32k1xx_lpspidev_s *)dev; uint32_t setbits; uint32_t clrbits; - int savbits = nbits; spiinfo("features=%08x\n", features); @@ -1164,7 +1163,7 @@ static int s32k1xx_lpspi_hwfeatures(FAR struct spi_dev_s *dev, clrbits = LPSPI_TCR_LSBF; } - s32k1xx_lpspi_modigyreg32(priv, S32K1XX_LPSPI_TCR_OFFSET, clrbits, setbits); + s32k1xx_lpspi_modifyreg32(priv, S32K1XX_LPSPI_TCR_OFFSET, clrbits, setbits); /* Other H/W features are not supported */ diff --git a/arch/arm/src/stm32f7/stm32_spi.c b/arch/arm/src/stm32f7/stm32_spi.c index 1904b91855..e394a44d09 100644 --- a/arch/arm/src/stm32f7/stm32_spi.c +++ b/arch/arm/src/stm32f7/stm32_spi.c @@ -1545,11 +1545,8 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, #endif #ifdef CONFIG_SPI_BITORDER - uint16_t setbitscr1; - uint16_t clrbitscr1; - uint16_t setbitscr2; - uint16_t clrbitscr2; - int savbits = nbits; + uint16_t setbits; + uint16_t clrbits; spiinfo("features=%08x\n", features); @@ -1791,13 +1788,15 @@ static void spi_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer, DEBUGASSERT(priv != NULL); - /* Convert the number of word to a number of bytes */ + /* Convert the number of word to a number of bytes. */ size_t nbytes = (priv->nbits > 8) ? nwords << 1 : nwords; #ifdef CONFIG_STM32F7_SPI_DMATHRESHOLD - /* If this is a small SPI transfer, then let spi_exchange_nodma() do the work. */ + /* If this is a small SPI transfer, then let spi_exchange_nodma() + * do the work. + */ if (nbytes <= CONFIG_STM32F7_SPI_DMATHRESHOLD) { @@ -1847,10 +1846,10 @@ static void spi_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer, /* If this bus uses a in driver buffers we will incur 2 copies, * The copy cost is << less the non DMA transfer time and having - * the buffer in the driver ensures DMA can be used. This is bacause + * the buffer in the driver ensures DMA can be used. This is because * the API does not support passing the buffer extent so the only * extent is buffer + the transfer size. These can sizes be less than - * the cache line size, and not aligned and tyicaly greater then 4 + * the cache line size, and not aligned and typically greater then 4 * bytes, which is about the break even point for the DMA IO overhead. */ @@ -2081,7 +2080,9 @@ static int spi_pm_prepare(FAR struct pm_callback_s *cb, int domain, if (sval <= 0) { - /* Exclusive lock is held, do not allow entry to deeper PM states. */ + /* Exclusive lock is held, do not allow entry to deeper + * PM states. + */ return -EBUSY; }