summaryrefslogtreecommitdiffstats
path: root/drivers/iio/light
diff options
context:
space:
mode:
authorHartmut Knaack <knaack.h@gmx.de>2015-07-09 23:51:32 +0200
committerJonathan Cameron <jic23@kernel.org>2015-08-12 22:16:27 +0100
commit952c3aa3fb5538aa5026980cfdedb3d38829b67e (patch)
tree6123804ed69b168bb7de36b428afca3b7f5e9a2a /drivers/iio/light
parent7c7a9eeaa335df03d692ad65e0767020ad1be374 (diff)
downloadop-kernel-dev-952c3aa3fb5538aa5026980cfdedb3d38829b67e.zip
op-kernel-dev-952c3aa3fb5538aa5026980cfdedb3d38829b67e.tar.gz
iio:light:stk3310: use correct names and type for state
Indicate the bit number of predefined states, make use of these names and change the state type in _resume to u8 to avoid type casting. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Reviewed-by: Tiberiu Breana <tiberiu.a.breana@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/light')
-rw-r--r--drivers/iio/light/stk3310.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c
index 09f2f6a..e5e0b04 100644
--- a/drivers/iio/light/stk3310.c
+++ b/drivers/iio/light/stk3310.c
@@ -35,8 +35,8 @@
#define STK3310_REG_ID 0x3E
#define STK3310_MAX_REG 0x80
-#define STK3310_STATE_EN_PS 0x01
-#define STK3310_STATE_EN_ALS 0x02
+#define STK3310_STATE_EN_PS BIT(0)
+#define STK3310_STATE_EN_ALS BIT(1)
#define STK3310_STATE_STANDBY 0x00
#define STK3310_CHIP_ID_VAL 0x13
@@ -436,8 +436,8 @@ static int stk3310_set_state(struct stk3310_data *data, u8 state)
dev_err(&client->dev, "failed to change sensor state\n");
} else if (state != STK3310_STATE_STANDBY) {
/* Don't reset the 'enabled' flags if we're going in standby */
- data->ps_enabled = !!(state & 0x01);
- data->als_enabled = !!(state & 0x02);
+ data->ps_enabled = !!(state & STK3310_STATE_EN_PS);
+ data->als_enabled = !!(state & STK3310_STATE_EN_ALS);
}
mutex_unlock(&data->lock);
@@ -683,7 +683,7 @@ static int stk3310_suspend(struct device *dev)
static int stk3310_resume(struct device *dev)
{
- int state = 0;
+ u8 state = 0;
struct stk3310_data *data;
data = iio_priv(i2c_get_clientdata(to_i2c_client(dev)));
OpenPOWER on IntegriCloud