You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/02/18 11:30:02 UTC

[GitHub] [incubator-nuttx] Palmitoxico opened a new pull request #2867: lpc17xx_40xx/lpc17_40_i2c.c: Propagate I2C I/O errors

Palmitoxico opened a new pull request #2867:
URL: https://github.com/apache/incubator-nuttx/pull/2867


   Check if all messages were transferred, if not, return -ENXIO.
   
   This is particularly useful when the slave returns an unexpected NAK,
   the application code should catch the error to avoid failing silently.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] Palmitoxico commented on a change in pull request #2867: lpc17xx_40xx/lpc17_40_i2c.c: Propagate I2C I/O errors

Posted by GitBox <gi...@apache.org>.
Palmitoxico commented on a change in pull request #2867:
URL: https://github.com/apache/incubator-nuttx/pull/2867#discussion_r578742894



##########
File path: arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.c
##########
@@ -242,7 +244,18 @@ static int lpc17_40_i2c_start(struct lpc17_40_i2cdev_s *priv)
            lpc17_40_i2c_timeout, (wdparm_t)priv);
   nxsem_wait(&priv->wait);
 
-  return priv->nmsg;

Review comment:
       I thought that returning the number o messages transmitted was required, but digging a little bit in the source code revealed that it is optional according to the I2C master driver documentation:
   https://github.com/apache/incubator-nuttx/blob/master/include/nuttx/i2c/i2c_master.h#L146-L154
   
   In this case, your suggestion seems cleaner. I'll update the PR.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #2867: lpc17xx_40xx/lpc17_40_i2c.c: Propagate I2C I/O errors

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #2867:
URL: https://github.com/apache/incubator-nuttx/pull/2867#discussion_r578691594



##########
File path: arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.c
##########
@@ -242,7 +244,18 @@ static int lpc17_40_i2c_start(struct lpc17_40_i2cdev_s *priv)
            lpc17_40_i2c_timeout, (wdparm_t)priv);
   nxsem_wait(&priv->wait);
 
-  return priv->nmsg;

Review comment:
       why not simplify to:
   ```
   return priv->nmsg ? -ENXIO : OK;
   ```
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #2867: lpc17xx_40xx/lpc17_40_i2c.c: Propagate I2C I/O errors

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #2867:
URL: https://github.com/apache/incubator-nuttx/pull/2867#discussion_r578691594



##########
File path: arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.c
##########
@@ -242,7 +244,18 @@ static int lpc17_40_i2c_start(struct lpc17_40_i2cdev_s *priv)
            lpc17_40_i2c_timeout, (wdparm_t)priv);
   nxsem_wait(&priv->wait);
 
-  return priv->nmsg;

Review comment:
       why not simplify to:
   ```
   return priv->nmsg ? -ENXIO : 0;
   ```
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #2867: lpc17xx_40xx/lpc17_40_i2c.c: Propagate I2C I/O errors

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #2867:
URL: https://github.com/apache/incubator-nuttx/pull/2867


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org