Skip to content

Commit

Permalink
i2c: shorten error code I2C_ERROR_QUERY_SUPPORT to I2C_ERROR_QUERY
Browse files Browse the repository at this point in the history
  • Loading branch information
vsergeev committed Oct 1, 2019
1 parent fcb8825 commit 8b21d06
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions docs/i2c.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ The periphery I2C functions return 0 on success or one of the negative error cod

The libc errno of the failure in an underlying libc library call can be obtained with the `i2c_errno()` helper function. A human readable error message can be obtained with the `i2c_errmsg()` helper function.

| Error Code | Description |
|---------------------------|---------------------------------------|
| `I2C_ERROR_ARG` | Invalid arguments |
| `I2C_ERROR_OPEN` | Opening I2C device |
| `I2C_ERROR_QUERY_SUPPORT` | Querying I2C support on I2C device |
| `I2C_ERROR_NOT_SUPPORTED` | I2C not supported on this device |
| `I2C_ERROR_TRANSFER` | I2C transfer |
| `I2C_ERROR_CLOSE` | Closing I2C device |
| Error Code | Description |
|---------------------------|-----------------------------------|
| `I2C_ERROR_ARG` | Invalid arguments |
| `I2C_ERROR_OPEN` | Opening I2C device |
| `I2C_ERROR_QUERY` | Querying I2C device attribtues |
| `I2C_ERROR_NOT_SUPPORTED` | I2C not supported on this device |
| `I2C_ERROR_TRANSFER` | I2C transfer |
| `I2C_ERROR_CLOSE` | Closing I2C device |

### EXAMPLE

Expand Down
2 changes: 1 addition & 1 deletion src/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int i2c_open(i2c_t *i2c, const char *path) {
if (ioctl(i2c->fd, I2C_FUNCS, &supported_funcs) < 0) {
int errsv = errno;
close(i2c->fd);
return _i2c_error(i2c, I2C_ERROR_QUERY_SUPPORT, errsv, "Querying I2C_FUNCS");
return _i2c_error(i2c, I2C_ERROR_QUERY, errsv, "Querying I2C functions");
}

if (!(supported_funcs & I2C_FUNC_I2C)) {
Expand Down
4 changes: 2 additions & 2 deletions src/i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ extern "C" {
enum i2c_error_code {
I2C_ERROR_ARG = -1, /* Invalid arguments */
I2C_ERROR_OPEN = -2, /* Opening I2C device */
I2C_ERROR_QUERY_SUPPORT = -3, /* Querying I2C support on I2C device */
I2C_ERROR_NOT_SUPPORTED = -4, /* I2C not suppoted on this device */
I2C_ERROR_QUERY = -3, /* Querying I2C device attributes */
I2C_ERROR_NOT_SUPPORTED = -4, /* I2C not supported on this device */
I2C_ERROR_TRANSFER = -5, /* I2C transfer */
I2C_ERROR_CLOSE = -6, /* Closing I2C device */
};
Expand Down

0 comments on commit 8b21d06

Please sign in to comment.