summaryrefslogtreecommitdiff
path: root/drivers/iio/light/opt4060.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iio/light/opt4060.c')
-rw-r--r--drivers/iio/light/opt4060.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/iio/light/opt4060.c b/drivers/iio/light/opt4060.c
index ab55f8d2ea0c..566f1bb8fe2a 100644
--- a/drivers/iio/light/opt4060.c
+++ b/drivers/iio/light/opt4060.c
@@ -311,7 +311,7 @@ any_mode_retry:
* concurrently change. And we just keep trying until we get one
* of the modes...
*/
- if (iio_device_claim_direct_mode(indio_dev))
+ if (!iio_device_claim_direct(indio_dev))
goto any_mode_retry;
/*
* This path means that we managed to claim direct mode. In
@@ -320,7 +320,8 @@ any_mode_retry:
*/
ret = opt4060_set_state_common(chip, continuous_sampling,
continuous_irq);
- iio_device_release_direct_mode(indio_dev);
+ iio_device_release_direct(indio_dev);
+ return ret;
} else {
/*
* This path means that we managed to claim buffer mode. In
@@ -1062,7 +1063,7 @@ static const struct regmap_config opt4060_regmap_config = {
.name = "opt4060",
.reg_bits = 8,
.val_bits = 16,
- .cache_type = REGCACHE_RBTREE,
+ .cache_type = REGCACHE_MAPLE,
.max_register = OPT4060_DEVICE_ID,
.readable_reg = opt4060_readable_reg,
.writeable_reg = opt4060_writable_reg,
@@ -1082,7 +1083,7 @@ static irqreturn_t opt4060_trigger_handler(int irq, void *p)
struct {
u32 chan[OPT4060_NUM_CHANS];
aligned_s64 ts;
- } raw;
+ } raw = { };
int i = 0;
int chan, ret;
@@ -1090,8 +1091,6 @@ static irqreturn_t opt4060_trigger_handler(int irq, void *p)
if (iio_trigger_validate_own_device(idev->trig, idev))
opt4060_trigger_new_samples(idev);
- memset(&raw, 0, sizeof(raw));
-
iio_for_each_active_channel(idev, chan) {
if (chan == OPT4060_ILLUM)
ret = opt4060_calc_illuminance(chip, &raw.chan[i++]);