diff --git a/arch/arm/src/imxrt/imxrt_lpspi.c b/arch/arm/src/imxrt/imxrt_lpspi.c index 34a449146c..84448820c4 100644 --- a/arch/arm/src/imxrt/imxrt_lpspi.c +++ b/arch/arm/src/imxrt/imxrt_lpspi.c @@ -1122,7 +1122,6 @@ static void imxrt_lpspi_setbits(FAR struct spi_dev_s *dev, int nbits) { FAR struct imxrt_lpspidev_s *priv = (FAR struct imxrt_lpspidev_s *)dev; uint32_t men; - int savbits = nbits; spiinfo("nbits=%d\n", nbits); @@ -1148,12 +1147,11 @@ static void imxrt_lpspi_setbits(FAR struct spi_dev_s *dev, int nbits) LPSPI_TCR_FRAMESZ_MASK, LPSPI_TCR_FRAMESZ(nbits - 1)); - /* Save the selection so the subsequence re-configurations - * will be faster + /* Save the selection so the subsequent re-configurations + * will be faster. */ - priv->nbits = savbits; /* nbits has been clobbered... save the signed - * value. */ + priv->nbits = nbits; /* Re-enable LPSPI if it was enabled previously */ diff --git a/arch/arm/src/s32k1xx/s32k1xx_lpspi.c b/arch/arm/src/s32k1xx/s32k1xx_lpspi.c index b0cb406a93..e601613125 100644 --- a/arch/arm/src/s32k1xx/s32k1xx_lpspi.c +++ b/arch/arm/src/s32k1xx/s32k1xx_lpspi.c @@ -1084,7 +1084,6 @@ static void s32k1xx_lpspi_setbits(FAR struct spi_dev_s *dev, int nbits) FAR struct s32k1xx_lpspidev_s *priv = (FAR struct s32k1xx_lpspidev_s *)dev; uint32_t regval; uint32_t men; - int savbits = nbits; spiinfo("nbits=%d\n", nbits); @@ -1111,10 +1110,9 @@ static void s32k1xx_lpspi_setbits(FAR struct spi_dev_s *dev, int nbits) s32k1xx_lpspi_putreg32(priv, S32K1XX_LPSPI_TCR_OFFSET, regval); - /* Save the selection so the subsequence re-configurations will be faster */ + /* Save the selection so that subsequent re-configurations will be faster. */ - priv->nbits = savbits; /* nbits has been clobbered... save the signed - * value. */ + priv->nbits = nbits; /* Re-enable LPSPI if it was enabled previously */ diff --git a/arch/arm/src/stm32f0l0g0/stm32_spi.c b/arch/arm/src/stm32f0l0g0/stm32_spi.c index 20b5abcbdc..2a5a5553cf 100644 --- a/arch/arm/src/stm32f0l0g0/stm32_spi.c +++ b/arch/arm/src/stm32f0l0g0/stm32_spi.c @@ -1095,7 +1095,6 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits) FAR struct stm32_spidev_s *priv = (FAR struct stm32_spidev_s *)dev; uint16_t setbits; uint16_t clrbits; - int savbits = nbits; spiinfo("nbits=%d\n", nbits); @@ -1157,9 +1156,9 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits) spi_modifycr(STM32_SPI_CR1_OFFSET, priv, SPI_CR1_SPE, 0); #endif - /* Save the selection so the subsequence re-configurations will be faster */ + /* Save the selection so that subsequent re-configurations will be faster. */ - priv->nbits = savbits; /* nbits has been clobbered... save the signed value. */ + priv->nbits = nbits; } } diff --git a/arch/arm/src/stm32f7/stm32_spi.c b/arch/arm/src/stm32f7/stm32_spi.c index f6b2e6b374..1904b91855 100644 --- a/arch/arm/src/stm32f7/stm32_spi.c +++ b/arch/arm/src/stm32f7/stm32_spi.c @@ -1476,7 +1476,6 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits) FAR struct stm32_spidev_s *priv = (FAR struct stm32_spidev_s *)dev; uint16_t setbits; uint16_t clrbits; - int savbits = nbits; spiinfo("nbits=%d\n", nbits); @@ -1513,9 +1512,11 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits) spi_modifycr2(priv, setbits, clrbits); spi_modifycr1(priv, SPI_CR1_SPE, 0); - /* Save the selection so the subsequence re-configurations will be faster */ + /* Save the selection so that subsequent re-configurations will + * be faster. + */ - priv->nbits = savbits; /* nbits has been clobbered... save the signed value. */ + priv->nbits = nbits; } } diff --git a/arch/arm/src/stm32h7/stm32_spi.c b/arch/arm/src/stm32h7/stm32_spi.c index 78d96864cf..c684f58e89 100644 --- a/arch/arm/src/stm32h7/stm32_spi.c +++ b/arch/arm/src/stm32h7/stm32_spi.c @@ -1594,7 +1594,6 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits) FAR struct stm32_spidev_s *priv = (FAR struct stm32_spidev_s *)dev; uint32_t setbits = 0; uint32_t clrbits = 0; - int savbits = nbits; spiinfo("nbits=%d\n", nbits); @@ -1633,11 +1632,11 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits) spi_modifyreg(priv, STM32_SPI_CFG1_OFFSET, clrbits, setbits); spi_enable(priv, true); - /* Save the selection so the subsequence re-configurations will be - * faster + /* Save the selection so that subsequent re-configurations will be + * faster. */ - priv->nbits = savbits; /* nbits has been clobbered... save the signed value */ + priv->nbits = nbits; } } diff --git a/arch/arm/src/stm32h7/stm32_spi_slave.c b/arch/arm/src/stm32h7/stm32_spi_slave.c index e2e6025874..42b8d8cfea 100644 --- a/arch/arm/src/stm32h7/stm32_spi_slave.c +++ b/arch/arm/src/stm32h7/stm32_spi_slave.c @@ -1028,7 +1028,6 @@ static void spi_setbits(FAR struct spi_sctrlr_s *sctrlr, int nbits) FAR struct stm32_spidev_s *priv = (FAR struct stm32_spidev_s *)sctrlr; uint32_t setbits = 0; uint32_t clrbits = 0; - int savbits = nbits; spiinfo("nbits=%d\n", nbits); @@ -1065,7 +1064,7 @@ static void spi_setbits(FAR struct spi_sctrlr_s *sctrlr, int nbits) spi_modifyreg(priv, STM32_SPI_CFG1_OFFSET, clrbits, setbits); - priv->nbits = savbits; + priv->nbits = nbits; } } diff --git a/arch/arm/src/stm32l4/stm32l4_spi.c b/arch/arm/src/stm32l4/stm32l4_spi.c index 39c457660a..c39c710505 100644 --- a/arch/arm/src/stm32l4/stm32l4_spi.c +++ b/arch/arm/src/stm32l4/stm32l4_spi.c @@ -1149,7 +1149,6 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits) FAR struct stm32l4_spidev_s *priv = (FAR struct stm32l4_spidev_s *)dev; uint16_t setbits; uint16_t clrbits; - int savbits = nbits; spiinfo("nbits=%d\n", nbits); @@ -1187,11 +1186,11 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits) spi_modifycr(STM32L4_SPI_CR2_OFFSET, priv, setbits, clrbits); spi_modifycr(STM32L4_SPI_CR1_OFFSET, priv, SPI_CR1_SPE, 0); - /* Save the selection so the subsequence re-configurations will be - * faster. nbits has been clobbered... save the signed value. + /* Save the selection so that subsequent re-configurations will be + * faster. */ - priv->nbits = savbits; + priv->nbits = nbits; } }