ret = i2c_master_send(st->i2c, st->tx, 3);
mutex_unlock(&st->buf_lock);
- return ret;
+ return ret < 0 ? ret : 0;
}
static int ade7854_i2c_write_reg_16(struct device *dev,
ret = i2c_master_send(st->i2c, st->tx, 4);
mutex_unlock(&st->buf_lock);
- return ret;
+ return ret < 0 ? ret : 0;
}
static int ade7854_i2c_write_reg_24(struct device *dev,
ret = i2c_master_send(st->i2c, st->tx, 5);
mutex_unlock(&st->buf_lock);
- return ret;
+ return ret < 0 ? ret : 0;
}
static int ade7854_i2c_write_reg_32(struct device *dev,
ret = i2c_master_send(st->i2c, st->tx, 6);
mutex_unlock(&st->buf_lock);
- return ret;
+ return ret < 0 ? ret : 0;
}
static int ade7854_i2c_read_reg_8(struct device *dev,
st->tx[1] = reg_address & 0xFF;
ret = i2c_master_send(st->i2c, st->tx, 2);
- if (ret)
+ if (ret < 0)
goto out;
ret = i2c_master_recv(st->i2c, st->rx, 1);
- if (ret)
+ if (ret < 0)
goto out;
*val = st->rx[0];
st->tx[1] = reg_address & 0xFF;
ret = i2c_master_send(st->i2c, st->tx, 2);
- if (ret)
+ if (ret < 0)
goto out;
ret = i2c_master_recv(st->i2c, st->rx, 2);
- if (ret)
+ if (ret < 0)
goto out;
*val = (st->rx[0] << 8) | st->rx[1];
st->tx[1] = reg_address & 0xFF;
ret = i2c_master_send(st->i2c, st->tx, 2);
- if (ret)
+ if (ret < 0)
goto out;
ret = i2c_master_recv(st->i2c, st->rx, 3);
- if (ret)
+ if (ret < 0)
goto out;
*val = (st->rx[0] << 16) | (st->rx[1] << 8) | st->rx[2];
st->tx[1] = reg_address & 0xFF;
ret = i2c_master_send(st->i2c, st->tx, 2);
- if (ret)
+ if (ret < 0)
goto out;
ret = i2c_master_recv(st->i2c, st->rx, 3);
- if (ret)
+ if (ret < 0)
goto out;
*val = (st->rx[0] << 24) | (st->rx[1] << 16) |
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
ret = st->read_reg_8(dev, this_attr->address, &val);
- if (ret)
+ if (ret < 0)
return ret;
return sprintf(buf, "%u\n", val);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
ret = st->read_reg_16(dev, this_attr->address, &val);
- if (ret)
+ if (ret < 0)
return ret;
return sprintf(buf, "%u\n", val);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
ret = st->read_reg_24(dev, this_attr->address, &val);
- if (ret)
+ if (ret < 0)
return ret;
return sprintf(buf, "%u\n", val);
struct ade7854_state *st = iio_priv(indio_dev);
ret = st->read_reg_32(dev, this_attr->address, &val);
- if (ret)
+ if (ret < 0)
return ret;
return sprintf(buf, "%u\n", val);
u32 irqen;
ret = st->read_reg_32(dev, ADE7854_MASK0, &irqen);
- if (ret)
+ if (ret < 0)
return ret;
if (enable)