Given both vcnl4000_init() and vcnl4200_init() end with
dev->chip_spec->set_power_state(), they can be called once from the
probe to enable the sensors. Move the set_power_state function from init
and call it after init function in probe.
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
data->rev = ret & 0xf;
data->al_scale = 250000;
- return data->chip_spec->set_power_state(data, true);
+ return 0;
};
static ssize_t vcnl4000_write_als_enable(struct vcnl4000_data *data, bool en)
if (ret < 0)
return ret;
- ret = data->chip_spec->set_power_state(data, true);
- if (ret < 0)
- return ret;
-
return 0;
};
if (ret < 0)
return ret;
+ ret = data->chip_spec->set_power_state(data, true);
+ if (ret)
+ return ret;
+
dev_dbg(&client->dev, "%s Ambient light/proximity sensor, Rev: %02x\n",
data->chip_spec->prod, data->rev);