hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/regulator/lp8788-ldo.c
....@@ -1,14 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * TI LP8788 MFD - ldo regulator driver
34 *
45 * Copyright 2012 Texas Instruments
56 *
67 * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
11
- *
128 */
139
1410 #include <linux/module.h>
....@@ -186,7 +182,7 @@
186182 .enable_time = lp8788_ldo_enable_time,
187183 };
188184
189
-static struct regulator_desc lp8788_dldo_desc[] = {
185
+static const struct regulator_desc lp8788_dldo_desc[] = {
190186 {
191187 .name = "dldo1",
192188 .id = DLDO1,
....@@ -343,7 +339,7 @@
343339 },
344340 };
345341
346
-static struct regulator_desc lp8788_aldo_desc[] = {
342
+static const struct regulator_desc lp8788_aldo_desc[] = {
347343 {
348344 .name = "aldo1",
349345 .id = ALDO1,
....@@ -468,7 +464,7 @@
468464 {
469465 struct lp8788 *lp = ldo->lp;
470466 enum lp8788_ext_ldo_en_id enable_id;
471
- u8 en_mask[] = {
467
+ static const u8 en_mask[] = {
472468 [EN_ALDO1] = LP8788_EN_SEL_ALDO1_M,
473469 [EN_ALDO234] = LP8788_EN_SEL_ALDO234_M,
474470 [EN_ALDO5] = LP8788_EN_SEL_ALDO5_M,
....@@ -501,11 +497,16 @@
501497 return 0;
502498 }
503499
504
- /* FIXME: check default mode for GPIO here: high or low? */
505
- ldo->ena_gpiod = devm_gpiod_get_index_optional(&pdev->dev,
506
- "enable",
507
- enable_id,
508
- GPIOD_OUT_HIGH);
500
+ /*
501
+ * Do not use devm* here: the regulator core takes over the
502
+ * lifecycle management of the GPIO descriptor.
503
+ * FIXME: check default mode for GPIO here: high or low?
504
+ */
505
+ ldo->ena_gpiod = gpiod_get_index_optional(&pdev->dev,
506
+ "enable",
507
+ enable_id,
508
+ GPIOD_OUT_HIGH |
509
+ GPIOD_FLAGS_BIT_NONEXCLUSIVE);
509510 if (IS_ERR(ldo->ena_gpiod))
510511 return PTR_ERR(ldo->ena_gpiod);
511512