i2c/i2c_master.h: Change incorrect comment about I2C_TRANSFER return value to indicate that the method returns zero on success rather than the number of bytes transferred.

This commit is contained in:
Juha Niskanen
2018-03-22 06:51:09 -06:00
committed by Gregory Nutt
parent bcd1f1f774
commit 4e4229a8ef
6 changed files with 18 additions and 15 deletions
+3 -3
View File
@@ -1441,11 +1441,11 @@ static int efm32_i2c_transfer(FAR struct i2c_master_s *dev,
FAR struct efm32_i2c_priv_s *priv = (struct efm32_i2c_priv_s *)dev; FAR struct efm32_i2c_priv_s *priv = (struct efm32_i2c_priv_s *)dev;
int ret = OK; int ret = OK;
ASSERT(count); DEBUGASSERT(count > 0);
if (count == 0 || msgs == NULL) if (count <= 0 || msgs == NULL)
{ {
return -1; return -EINVAL;
} }
/* Ensure that address or flags don't change meanwhile */ /* Ensure that address or flags don't change meanwhile */
+5 -6
View File
@@ -967,8 +967,12 @@ static int lc823450_i2c_transfer(FAR struct i2c_master_s *dev,
FAR struct i2c_msg_s *msgs, int count) FAR struct i2c_msg_s *msgs, int count)
{ {
FAR struct lc823450_i2c_priv_s *priv = (struct lc823450_i2c_priv_s *)dev; FAR struct lc823450_i2c_priv_s *priv = (struct lc823450_i2c_priv_s *)dev;
irqstate_t irqs;
int ret = 0;
if (!msgs || count == 0) DEBUGASSERT(count > 0);
if (count <= 0 || msgs == NULL)
{ {
i2cerr("ERROR: invalid param, %p %d\n", msgs, count); i2cerr("ERROR: invalid param, %p %d\n", msgs, count);
return -EINVAL; return -EINVAL;
@@ -978,11 +982,6 @@ static int lc823450_i2c_transfer(FAR struct i2c_master_s *dev,
lc823450_i2c_sem_wait(priv); lc823450_i2c_sem_wait(priv);
irqstate_t irqs;
int ret = 0;
ASSERT(count);
priv->timedout = false; priv->timedout = false;
#ifdef CONFIG_I2C_RESET #ifdef CONFIG_I2C_RESET
+3 -2
View File
@@ -1583,14 +1583,15 @@ static int stm32_i2c_transfer(FAR struct i2c_master_s *dev, FAR struct i2c_msg_s
int count) int count)
{ {
FAR struct stm32_i2c_priv_s *priv = (struct stm32_i2c_priv_s *)dev; FAR struct stm32_i2c_priv_s *priv = (struct stm32_i2c_priv_s *)dev;
stm32_i2c_sem_wait(priv); /* Ensure that address or flags don't change meanwhile */
uint32_t status = 0; uint32_t status = 0;
#ifdef I2C1_FSMC_CONFLICT #ifdef I2C1_FSMC_CONFLICT
uint32_t ahbenr; uint32_t ahbenr;
#endif #endif
int ret = 0; int ret = 0;
ASSERT(count); DEBUGASSERT(count > 0);
stm32_i2c_sem_wait(priv); /* Ensure that address or flags don't change meanwhile */
#ifdef I2C1_FSMC_CONFLICT #ifdef I2C1_FSMC_CONFLICT
/* Disable FSMC that shares a pin with I2C1 (LBAR) */ /* Disable FSMC that shares a pin with I2C1 (LBAR) */
+1 -1
View File
@@ -2309,7 +2309,7 @@ static int stm32_i2c_process(FAR struct i2c_master_s *dev, FAR struct i2c_msg_s
int errval = 0; int errval = 0;
int waitrc = 0; int waitrc = 0;
ASSERT(count); DEBUGASSERT(count > 0);
/* Wait for any STOP in progress */ /* Wait for any STOP in progress */
+1 -1
View File
@@ -2459,7 +2459,7 @@ static int stm32l4_i2c_process(FAR struct i2c_master_s *dev,
int errval = 0; int errval = 0;
int waitrc = 0; int waitrc = 0;
ASSERT(count); DEBUGASSERT(count > 0);
/* Wait for any STOP in progress */ /* Wait for any STOP in progress */
+4 -1
View File
@@ -121,7 +121,10 @@
* count - The number of transfers to perform * count - The number of transfers to perform
* *
* Returned Value: * Returned Value:
* The number of transfers completed * Zero (OK) or positive on success; a negated errno value on failure.
*
* Note : some implementations of this interface return the number of
* transfers completed, but others return OK on success.
* *
****************************************************************************/ ****************************************************************************/