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

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;
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 */

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 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);
return -EINVAL;
@ -978,11 +982,6 @@ static int lc823450_i2c_transfer(FAR struct i2c_master_s *dev,
lc823450_i2c_sem_wait(priv);
irqstate_t irqs;
int ret = 0;
ASSERT(count);
priv->timedout = false;
#ifdef CONFIG_I2C_RESET

View File

@ -1583,14 +1583,15 @@ static int stm32_i2c_transfer(FAR struct i2c_master_s *dev, FAR struct i2c_msg_s
int count)
{
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;
#ifdef I2C1_FSMC_CONFLICT
uint32_t ahbenr;
#endif
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
/* Disable FSMC that shares a pin with I2C1 (LBAR) */

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 waitrc = 0;
ASSERT(count);
DEBUGASSERT(count > 0);
/* Wait for any STOP in progress */

View File

@ -2459,7 +2459,7 @@ static int stm32l4_i2c_process(FAR struct i2c_master_s *dev,
int errval = 0;
int waitrc = 0;
ASSERT(count);
DEBUGASSERT(count > 0);
/* Wait for any STOP in progress */

View File

@ -112,7 +112,7 @@
* Description:
* Perform a sequence of I2C transfers, each transfer is started with a
* START and the final transfer is completed with a STOP. Each sequence
* will be an 'atomic' operation in the sense that any other I2C actions
* will be an 'atomic' operation in the sense that any other I2C actions
* will be serialized and pend until this sequence of transfers completes.
*
* Input Parameters:
@ -121,7 +121,10 @@
* count - The number of transfers to perform
*
* 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.
*
****************************************************************************/