Skip to content

Commit

Permalink
iio_device_reg_write: fix return value
Browse files Browse the repository at this point in the history
make the functions return 0 on success instead of the number of
bytes written, in accordance with the API
  • Loading branch information
gizero committed Jul 28, 2014
1 parent 62d6331 commit a08465c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion device.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,13 @@ int iio_device_identify_filename(const struct iio_device *dev,
int iio_device_reg_write(struct iio_device *dev,
uint32_t address, uint32_t value)
{
ssize_t ret;

char buf[1024];
snprintf(buf, sizeof(buf), "0x%x 0x%x", address, value);
return iio_device_debug_attr_write(dev, "direct_reg_access", buf);
ret = iio_device_debug_attr_write(dev, "direct_reg_access", buf);

return ret < 0 ? ret : 0;
}

int iio_device_reg_read(struct iio_device *dev,
Expand Down

0 comments on commit a08465c

Please sign in to comment.