power: regulator: common: use dm_gpio_is_valid helper
Use dm_gpio_is_valid() helper function instead of manually checking the gpio. Reviewed-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Tanmay Kathpalia <tanmay.kathpalia@altera.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Julien Stephan <jstephan@baylibre.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
@@ -51,7 +51,7 @@ int regulator_common_get_enable(const struct udevice *dev,
|
||||
struct regulator_common_plat *plat)
|
||||
{
|
||||
/* Enable GPIO is optional */
|
||||
if (!plat->gpio.dev)
|
||||
if (!dm_gpio_is_valid(&plat->gpio))
|
||||
return true;
|
||||
|
||||
return dm_gpio_get_value(&plat->gpio);
|
||||
|
||||
Reference in New Issue
Block a user