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

@ -1070,8 +1070,8 @@ static void spi_setbits(struct spi_dev_s *dev, int nbits)
* Set hardware-specific feature flags.
*
* Input Parameters:
* dev - Device-specific state data
* flags - H/W feature flags
* dev - Device-specific state data
* features - H/W feature flags
*
* Returned Value:
* 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 */
lsbfirst = ((hwfeatures & HWFEAT_LSBFIRST) != 0);
lsbfirst = ((features & HWFEAT_LSBFIRST) != 0);
/* 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;
}
return ((hwfeatures & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS;
/* Other H/W features are not supported */
return ((features & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS;
}
#endif

View File

@ -1186,8 +1186,8 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits)
* Set hardware-specific feature flags.
*
* Input Parameters:
* dev - Device-specific state data
* flags - H/W feature flags
* dev - Device-specific state data
* features - H/W feature flags
*
* Returned Value:
* 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? */
if ((hwfeatures & HWFEAT_LSBFIRST) != 0)
if ((features & HWFEAT_LSBFIRST) != 0)
{
setbits = SPI_CR1_LSBFIRST;
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, 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

View File

@ -1289,8 +1289,8 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits)
* Set hardware-specific feature flags.
*
* Input Parameters:
* dev - Device-specific state data
* flags - H/W feature flags
* dev - Device-specific state data
* features - H/W feature flags
*
* Returned Value:
* 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? */
if ((hwfeatures & HWFEAT_LSBFIRST) != 0)
if ((features & HWFEAT_LSBFIRST) != 0)
{
setbits = SPI_CR1_LSBFIRST;
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, 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

View File

@ -1153,8 +1153,8 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits)
* Set hardware-specific feature flags.
*
* Input Parameters:
* dev - Device-specific state data
* flags - H/W feature flags
* dev - Device-specific state data
* features - H/W feature flags
*
* Returned Value:
* 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? */
if ((hwfeatures & HWFEAT_LSBFIRST) != 0)
if ((features & HWFEAT_LSBFIRST) != 0)
{
setbits = SPI_CR1_LSBFIRST;
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, 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

View File

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