Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] proximity: vl53l0x: Make VDD regulator actually optional
@ 2022-06-14 11:20 Luca Weiss
  2022-06-18 16:55 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Luca Weiss @ 2022-06-14 11:20 UTC (permalink / raw)
  To: linux-iio
  Cc: ~postmarketos/upstreaming, phone-devel, Luca Weiss, Song Qiang,
	Jonathan Cameron, Lars-Peter Clausen, Liam Girdwood, Mark Brown,
	Markuss Broks, linux-kernel

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.

Fixes: d3d6dba56dab ("proximity: vl53l0x: Handle the VDD regulator")
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
@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(-)

diff --git a/drivers/iio/proximity/vl53l0x-i2c.c b/drivers/iio/proximity/vl53l0x-i2c.c
index 3b7a33ff601d..c7c4d33d340f 100644
--- a/drivers/iio/proximity/vl53l0x-i2c.c
+++ b/drivers/iio/proximity/vl53l0x-i2c.c
@@ -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");
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] proximity: vl53l0x: Make VDD regulator actually optional
  2022-06-14 11:20 [PATCH] proximity: vl53l0x: Make VDD regulator actually optional Luca Weiss
@ 2022-06-18 16:55 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2022-06-18 16:55 UTC (permalink / raw)
  To: Luca Weiss
  Cc: linux-iio, ~postmarketos/upstreaming, phone-devel, Song Qiang,
	Lars-Peter Clausen, Liam Girdwood, Mark Brown, Markuss Broks,
	linux-kernel

On Tue, 14 Jun 2022 13:20:50 +0200
Luca Weiss <luca.weiss@fairphone.com> wrote:

> 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.
> 
> Fixes: d3d6dba56dab ("proximity: vl53l0x: Handle the VDD regulator")
> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
> ---
> @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.

> 
>  drivers/iio/proximity/vl53l0x-i2c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/proximity/vl53l0x-i2c.c b/drivers/iio/proximity/vl53l0x-i2c.c
> index 3b7a33ff601d..c7c4d33d340f 100644
> --- a/drivers/iio/proximity/vl53l0x-i2c.c
> +++ b/drivers/iio/proximity/vl53l0x-i2c.c
> @@ -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");


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-18 16:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-14 11:20 [PATCH] proximity: vl53l0x: Make VDD regulator actually optional Luca Weiss
2022-06-18 16:55 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox