@@ -91,6 +91,10 @@ static int al3000a_init(struct al3000a_data *data)
if (ret)
return ret;
+ ret = devm_add_action_or_reset(&data->client->dev, al3000a_set_pwr_off, data);
+ if (ret)
+ return dev_err_probe(&data->client->dev, ret, "failed to add action\n");
+
ret = regmap_write(data->regmap, AL3000A_REG_SYSTEM, AL3000A_CONFIG_RESET);
if (ret)
return ret;
@@ -157,10 +161,6 @@ static int al3000a_probe(struct i2c_client *client)
if (ret)
return dev_err_probe(dev, ret, "failed to init ALS\n");
- ret = devm_add_action_or_reset(dev, al3000a_set_pwr_off, data);
- if (ret)
- return dev_err_probe(dev, ret, "failed to add action\n");
-
return devm_iio_device_register(dev, indio_dev);
}