proximity: vl53l0x: Make VDD regulator actually optional
Subsystems (2)
PATCH 1/1 proximity: vl53l0x: Make VDD regulator actually optional
Contrary to what the naming might suggest, devm_regulator_get_optional returns -ENODEV in case the regulator is not found which will trigger probe error in this driver.
Use devm_regulator_get instead which will return a dummy regulator that we can just use as if it was a proper regulator.
---
@Jonathan: As discussed in the other email, maybe you want to adjust/remove the "Fixes:" tag. Your call.
drivers/iio/proximity/vl53l0x-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/proximity/vl53l0x-i2c.c +1 -1
@@ -237,7 +237,7 @@ static int vl53l0x_probe(struct i2c_client *client) I2C_FUNC_SMBUS_BYTE_DATA))return -EOPNOTSUPP ; - data->vdd_supply =devm_regulator_get_optional (&client->dev,"vdd" ); + data->vdd_supply =devm_regulator_get (&client->dev,"vdd" );if (IS_ERR (data->vdd_supply))return dev_err_probe (&client->dev,PTR_ERR (data->vdd_supply),"Unable to get VDD regulator\n" );
Signature · 1 line
2.36.1
Quoted 4 lines · On Tue, 14 Jun 2022 13:20:50 +0200 Luca Weiss <[email protected]> wrote:
Contrary to what the naming might suggest,
devm_regulator_get_optionalreturns-ENODEVin case the regulator is not found which will trigger probe error in this driver.
Quoted 8 lines
Use
devm_regulator_getinstead which will return a dummy regulator that we can just use as if it was a proper regulator.Fixes d3d6dba56dab ("proximity: vl53l0x: Handle the VDD regulator")Signed-off-by Luca Weiss <[email protected]>---
@Jonathan: As discussed in the other email, maybe you want to adjust/remove the "Fixes:" tag. Your call.
Applied to the togreg branch of iio.git.
Quoted 17 lines
drivers/iio/proximity/vl53l0x-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/proximity/vl53l0x-i2c.c +1
-1@@ -237,7 +237,7 @@ static int vl53l0x_probe(struct i2c_client *client) I2C_FUNC_SMBUS_BYTE_DATA))return -EOPNOTSUPP ; - data->vdd_supply =devm_regulator_get_optional (&client->dev,"vdd" ); + data->vdd_supply =devm_regulator_get (&client->dev,"vdd" );if (IS_ERR (data->vdd_supply))return dev_err_probe (&client->dev,PTR_ERR (data->vdd_supply),"Unable to get VDD regulator\n" );