Commit 4fd4d7d8 authored by Peter Meerwald's avatar Peter Meerwald Committed by Greg Kroah-Hartman

staging: iio: reorganize hmc5843_set_rate()

Signed-off-by: default avatarPeter Meerwald <pmeerw@pmeerw.net>
Acked-by: default avatarJonathan Cameron <jic23@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4906a15c
......@@ -343,12 +343,13 @@ static s32 hmc5843_set_rate(struct i2c_client *client,
struct hmc5843_data *data = iio_priv(indio_dev);
u8 reg_val;
reg_val = (data->meas_conf) | (rate << HMC5843_RATE_OFFSET);
if (rate >= HMC5843_RATE_NOT_USED) {
dev_err(&client->dev,
"data output rate is not supported\n");
return -EINVAL;
}
reg_val = data->meas_conf | (rate << HMC5843_RATE_OFFSET);
return i2c_smbus_write_byte_data(client, HMC5843_CONFIG_REG_A, reg_val);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment