Fix cloned variable error in all SPI drivers

This commit is contained in:
Gregory Nutt 2016-08-08 11:04:01 -06:00
parent 2ae3953f9e
commit c3cfd37791
5 changed files with 27 additions and 18 deletions

View File

@ -1071,7 +1071,7 @@ static void spi_setbits(struct spi_dev_s *dev, int nbits)
* *
* Input Parameters: * Input Parameters:
* dev - Device-specific state data * dev - Device-specific state data
* flags - H/W feature flags * features - H/W feature flags
* *
* Returned Value: * Returned Value:
* Zero (OK) if the selected H/W features are enabled; A negated errno * Zero (OK) if the selected H/W features are enabled; A negated errno
@ -1094,7 +1094,7 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features)
/* Bit order is encoded by the sign of nbits */ /* Bit order is encoded by the sign of nbits */
lsbfirst = ((hwfeatures & HWFEAT_LSBFIRST) != 0); lsbfirst = ((features & HWFEAT_LSBFIRST) != 0);
/* Has the number of bits or the bit order changed? */ /* Has the number of bits or the bit order changed? */
@ -1121,7 +1121,9 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features)
priv->lsbfirst = lsbfirst; priv->lsbfirst = lsbfirst;
} }
return ((hwfeatures & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS; /* Other H/W features are not supported */
return ((features & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS;
} }
#endif #endif

View File

@ -1187,7 +1187,7 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits)
* *
* Input Parameters: * Input Parameters:
* dev - Device-specific state data * dev - Device-specific state data
* flags - H/W feature flags * features - H/W feature flags
* *
* Returned Value: * Returned Value:
* Zero (OK) if the selected H/W features are enabled; A negated errno * Zero (OK) if the selected H/W features are enabled; A negated errno
@ -1206,7 +1206,7 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features)
/* Transfer data LSB first? */ /* Transfer data LSB first? */
if ((hwfeatures & HWFEAT_LSBFIRST) != 0) if ((features & HWFEAT_LSBFIRST) != 0)
{ {
setbits = SPI_CR1_LSBFIRST; setbits = SPI_CR1_LSBFIRST;
clrbits = 0; clrbits = 0;
@ -1221,7 +1221,9 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features)
spi_modifycr1(priv, setbits, clrbits); spi_modifycr1(priv, setbits, clrbits);
spi_modifycr1(priv, SPI_CR1_SPE, 0); spi_modifycr1(priv, SPI_CR1_SPE, 0);
return ((hwfeatures & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS; /* Other H/W features are not supported */
return ((features & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS;
} }
#endif #endif

View File

@ -1290,7 +1290,7 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits)
* *
* Input Parameters: * Input Parameters:
* dev - Device-specific state data * dev - Device-specific state data
* flags - H/W feature flags * features - H/W feature flags
* *
* Returned Value: * Returned Value:
* Zero (OK) if the selected H/W features are enabled; A negated errno * Zero (OK) if the selected H/W features are enabled; A negated errno
@ -1312,7 +1312,7 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features)
/* Transfer data LSB first? */ /* Transfer data LSB first? */
if ((hwfeatures & HWFEAT_LSBFIRST) != 0) if ((features & HWFEAT_LSBFIRST) != 0)
{ {
setbits = SPI_CR1_LSBFIRST; setbits = SPI_CR1_LSBFIRST;
clrbits = 0; clrbits = 0;
@ -1327,7 +1327,9 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features)
spi_modifycr1(priv, setbits, clrbits); spi_modifycr1(priv, setbits, clrbits);
spi_modifycr1(priv, SPI_CR1_SPE, 0); spi_modifycr1(priv, SPI_CR1_SPE, 0);
return ((hwfeatures & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS; /* Other H/W features are not supported */
return ((features & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS;
} }
#endif #endif

View File

@ -1154,7 +1154,7 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits)
* *
* Input Parameters: * Input Parameters:
* dev - Device-specific state data * dev - Device-specific state data
* flags - H/W feature flags * features - H/W feature flags
* *
* Returned Value: * Returned Value:
* Zero (OK) if the selected H/W features are enabled; A negated errno * Zero (OK) if the selected H/W features are enabled; A negated errno
@ -1173,7 +1173,7 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features)
/* Transfer data LSB first? */ /* Transfer data LSB first? */
if ((hwfeatures & HWFEAT_LSBFIRST) != 0) if ((features & HWFEAT_LSBFIRST) != 0)
{ {
setbits = SPI_CR1_LSBFIRST; setbits = SPI_CR1_LSBFIRST;
clrbits = 0; clrbits = 0;
@ -1188,7 +1188,9 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features)
spi_modifycr(STM32L4_SPI_CR1_OFFSET, priv, setbits, clrbits); spi_modifycr(STM32L4_SPI_CR1_OFFSET, priv, setbits, clrbits);
spi_modifycr(STM32L4_SPI_CR1_OFFSET, priv, SPI_CR1_SPE, 0); spi_modifycr(STM32L4_SPI_CR1_OFFSET, priv, SPI_CR1_SPE, 0);
return ((hwfeatures & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS; /* Other H/W features are not supported */
return ((features & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS;
} }
#endif #endif

View File

@ -193,7 +193,7 @@
* *
* Input Parameters: * Input Parameters:
* dev - Device-specific state data * dev - Device-specific state data
* flags - H/W feature flags * features - H/W feature flags
* *
* Returned Value: * Returned Value:
* Zero (OK) if the selected H/W features are enabled; A negated errno * Zero (OK) if the selected H/W features are enabled; A negated errno
@ -237,6 +237,7 @@
# define HWFEAT_ESCAPE_LASTXFER (1 << 3) # define HWFEAT_ESCAPE_LASTXFER (1 << 3)
# endif # endif
# define HWFEAT_MSBFIRST (0 << 4)
# define HWFEAT_LSBFIRST (1 << 4) # define HWFEAT_LSBFIRST (1 << 4)
#else #else