summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorVianney le Clément de Saint-Marcq <vianney.leclement@essensium.com>2015-02-25 16:55:06 +0100
committerJonathan Cameron <jic23@kernel.org>2015-03-09 14:56:58 +0000
commitc7586584c6fd4212e3eb2e83e5cf3c043ddf72be (patch)
tree7191f4344e6b21f01be6094cfbb2074a6d4f0bf2 /drivers/iio
parent60d3e3bbd5992bb4478f9f99a4e4c5748a1a1ba7 (diff)
downloadop-kernel-dev-c7586584c6fd4212e3eb2e83e5cf3c043ddf72be.zip
op-kernel-dev-c7586584c6fd4212e3eb2e83e5cf3c043ddf72be.tar.gz
iio: mlx90614: Refactor register symbols
The defined registers only make sense when used for accessing RAM. Make MLX90614_OP_RAM part of the symbol definition to avoid accidental access to the wrong register. Signed-off-by: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/temperature/mlx90614.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/iio/temperature/mlx90614.c b/drivers/iio/temperature/mlx90614.c
index c8b6ac8..e2c6f1a 100644
--- a/drivers/iio/temperature/mlx90614.c
+++ b/drivers/iio/temperature/mlx90614.c
@@ -23,8 +23,8 @@
#define MLX90614_OP_RAM 0x00
/* RAM offsets with 16-bit data, MSB first */
-#define MLX90614_TA 0x06 /* ambient temperature */
-#define MLX90614_TOBJ1 0x07 /* object temperature */
+#define MLX90614_TA (MLX90614_OP_RAM | 0x06) /* ambient temperature */
+#define MLX90614_TOBJ1 (MLX90614_OP_RAM | 0x07) /* object 1 temperature */
struct mlx90614_data {
struct i2c_client *client;
@@ -42,13 +42,13 @@ static int mlx90614_read_raw(struct iio_dev *indio_dev,
switch (channel->channel2) {
case IIO_MOD_TEMP_AMBIENT:
ret = i2c_smbus_read_word_data(data->client,
- MLX90614_OP_RAM | MLX90614_TA);
+ MLX90614_TA);
if (ret < 0)
return ret;
break;
case IIO_MOD_TEMP_OBJECT:
ret = i2c_smbus_read_word_data(data->client,
- MLX90614_OP_RAM | MLX90614_TOBJ1);
+ MLX90614_TOBJ1);
if (ret < 0)
return ret;
break;
OpenPOWER on IntegriCloud