regulator: max8973: make default/unset dvs gpio as invalid gpio
authorLaxman Dewangan <ldewangan@nvidia.com>
Wed, 6 May 2015 12:50:09 +0000 (18:20 +0530)
committerMark Brown <broonie@kernel.org>
Thu, 21 May 2015 21:09:52 +0000 (22:09 +0100)
If platform data has dvs-gpio value 0 as default/unset then
make this as invalid gpio so that function gpio_is_valid()
can return false on this case.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/max8973-regulator.c

index be9a463d73540d176a568eaa4d48efad4bca14ed..3df5a84f819cddc065c59bb0cbe2f092665d5b60 100644 (file)
@@ -413,7 +413,7 @@ static int max8973_probe(struct i2c_client *client,
        }
 
        if (pdata) {
-               max->dvs_gpio = pdata->dvs_gpio;
+               max->dvs_gpio = (pdata->dvs_gpio) ? pdata->dvs_gpio : -EINVAL;
                max->enable_external_control = pdata->enable_ext_control;
                max->curr_gpio_val = pdata->dvs_def_state;
                max->curr_vout_reg = MAX8973_VOUT + pdata->dvs_def_state;