Skip to content

Commit 9b116ba

Browse files
Ciprian Marian Costeagroeck
authored andcommitted
hwmon: (ina2xx) make regulator 'vs' support optional
According to the 'ti,ina2xx' binding, the 'vs-supply' property is optional. Use devm_regulator_get_enable_optional() to avoid a kernel warning message if the property is not provided. Co-developed-by: Florin Buica <[email protected]> Tested-by: Enric Balletbo i Serra <[email protected]> Signed-off-by: Florin Buica <[email protected]> Signed-off-by: Ciprian Marian Costea <[email protected]> Link: https://lore.kernel.org/r/[email protected] [groeck: Use standard multi-line comment] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 0bf08f9 commit 9b116ba

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/hwmon/ina2xx.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,8 +959,12 @@ static int ina2xx_probe(struct i2c_client *client)
959959
return PTR_ERR(data->regmap);
960960
}
961961

962-
ret = devm_regulator_get_enable(dev, "vs");
963-
if (ret)
962+
/*
963+
* Regulator core returns -ENODEV if the 'vs' is not available.
964+
* Hence the check for -ENODEV return code is necessary.
965+
*/
966+
ret = devm_regulator_get_enable_optional(dev, "vs");
967+
if (ret < 0 && ret != -ENODEV)
964968
return dev_err_probe(dev, ret, "failed to enable vs regulator\n");
965969

966970
ret = ina2xx_init(dev, data);

0 commit comments

Comments
 (0)