i2c.c: Fix identation/style and simplify logic in mraa_i2c_read
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
e8cb060f4e
commit
efc79d13c0
@@ -202,13 +202,16 @@ int
|
|||||||
mraa_i2c_read(mraa_i2c_context dev, uint8_t* data, int length)
|
mraa_i2c_read(mraa_i2c_context dev, uint8_t* data, int length)
|
||||||
{
|
{
|
||||||
int bytes_read = 0;
|
int bytes_read = 0;
|
||||||
if (IS_FUNC_DEFINED(dev, i2c_read_replace))
|
if (IS_FUNC_DEFINED(dev, i2c_read_replace)) {
|
||||||
bytes_read = dev->advance_func->i2c_read_replace(dev, data, length);
|
bytes_read = dev->advance_func->i2c_read_replace(dev, data, length);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
bytes_read = read(dev->fh, data, length);
|
bytes_read = read(dev->fh, data, length);
|
||||||
if (bytes_read == length)
|
}
|
||||||
|
if (bytes_read == length) {
|
||||||
return length;
|
return length;
|
||||||
else
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user