hc
2024-05-10 ee930fffee469d076998274a2ca55e13dc1efb67
kernel/drivers/regulator/max8973-regulator.c
....@@ -758,6 +758,7 @@
758758 gflags = GPIOD_OUT_HIGH;
759759 else
760760 gflags = GPIOD_OUT_LOW;
761
+ gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE;
761762 gpiod = devm_gpiod_get_optional(&client->dev,
762763 "maxim,enable",
763764 gflags);
....@@ -807,7 +808,13 @@
807808 config.of_node = client->dev.of_node;
808809 config.regmap = max->regmap;
809810
810
- /* Register the regulators */
811
+ /*
812
+ * Register the regulators
813
+ * Turn the GPIO descriptor over to the regulator core for
814
+ * lifecycle management if we pass an ena_gpiod.
815
+ */
816
+ if (config.ena_gpiod)
817
+ devm_gpiod_unhinge(&client->dev, config.ena_gpiod);
811818 rdev = devm_regulator_register(&client->dev, &max->desc, &config);
812819 if (IS_ERR(rdev)) {
813820 ret = PTR_ERR(rdev);