From: Erikas Bitovtas Date: Fri, 20 Mar 2026 16:45:38 +0000 (+0200) Subject: iio: light: vcnl4000: move power enablement from init to probe X-Git-Tag: v7.1-rc1~17^2~120^2~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c9cb53572ee67d19c43191fe02eb937173ee9a7;p=thirdparty%2Fkernel%2Fstable.git iio: light: vcnl4000: move power enablement from init to probe 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 Signed-off-by: Erikas Bitovtas Reviewed-by: Andy Shevchenko Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index 939ff2d65105a..287ccd89cfb28 100644 --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -280,7 +280,7 @@ static int vcnl4000_init(struct vcnl4000_data *data) 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) @@ -425,10 +425,6 @@ static int vcnl4200_init(struct vcnl4000_data *data) if (ret < 0) return ret; - ret = data->chip_spec->set_power_state(data, true); - if (ret < 0) - return ret; - return 0; }; @@ -2003,6 +1999,10 @@ static int vcnl4000_probe(struct i2c_client *client) 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);