Merge tag 'docs-5.12-2' of git://git.lwn.net/linux
[linux-2.6-microblaze.git] / drivers / regulator / max8973-regulator.c
index e7a58b5..9aee144 100644 (file)
@@ -808,7 +808,13 @@ static int max8973_probe(struct i2c_client *client,
        config.of_node = client->dev.of_node;
        config.regmap = max->regmap;
 
-       /* Register the regulators */
+       /*
+        * Register the regulators
+        * Turn the GPIO descriptor over to the regulator core for
+        * lifecycle management if we pass an ena_gpiod.
+        */
+       if (config.ena_gpiod)
+               devm_gpiod_unhinge(&client->dev, config.ena_gpiod);
        rdev = devm_regulator_register(&client->dev, &max->desc, &config);
        if (IS_ERR(rdev)) {
                ret = PTR_ERR(rdev);