regulator: lp8788-ldo: Let core handle GPIO descriptor
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 6 Dec 2018 12:43:40 +0000 (13:43 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 11 Dec 2018 01:03:54 +0000 (01:03 +0000)
Use the gpiod_get() rather than the devm_* version so that the
regulator core can handle the lifecycle of these descriptors.

Fixes: 2468f0d51548 ("regulator: lp8788-ldo: Pass descriptor instead of GPIO number")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/lp8788-ldo.c

index 553b4790050f6650a525155b64ccd4cc3c71a6e9..2ee22e7ea675671a6348f0c2c2eb413a8e0fa330 100644 (file)
@@ -501,8 +501,12 @@ static int lp8788_config_ldo_enable_mode(struct platform_device *pdev,
                return 0;
        }
 
-       /* FIXME: check default mode for GPIO here: high or low? */
-       ldo->ena_gpiod = devm_gpiod_get_index_optional(&pdev->dev,
+       /*
+        * Do not use devm* here: the regulator core takes over the
+        * lifecycle management of the GPIO descriptor.
+        * FIXME: check default mode for GPIO here: high or low?
+        */
+       ldo->ena_gpiod = gpiod_get_index_optional(&pdev->dev,
                                               "enable",
                                               enable_id,
                                               GPIOD_OUT_HIGH |