Skip to content

Commit

Permalink
staging: iio: reorganize hmc5843_set_rate()
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Meerwald authored and Greg Kroah-Hartman committed May 17, 2012
1 parent 4906a15 commit 4fd4d7d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/staging/iio/magnetometer/hmc5843.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 4fd4d7d

Please sign in to comment.