Skip to content

Commit 31ca9ff

Browse files
committed
Merge tag 'regulator-fix-v6.19-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator fixes from Mark Brown: "A few fixes that came in during the merge window, nothing too exciting - the one core fix improves error propagation from gpiolib which hopefully shouldn't actually happen but is safer" * tag 'regulator-fix-v6.19-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: spacemit: Align input supply name with the DT binding regulator: fixed: Rely on the core freeing the enable GPIO regulator: check the return value of gpiod_set_value_cansleep()
2 parents 1de7411 + 99f0c3a commit 31ca9ff

3 files changed

Lines changed: 16 additions & 12 deletions

File tree

drivers/regulator/core.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2823,14 +2823,18 @@ static void regulator_ena_gpio_free(struct regulator_dev *rdev)
28232823
static int regulator_ena_gpio_ctrl(struct regulator_dev *rdev, bool enable)
28242824
{
28252825
struct regulator_enable_gpio *pin = rdev->ena_pin;
2826+
int ret;
28262827

28272828
if (!pin)
28282829
return -EINVAL;
28292830

28302831
if (enable) {
28312832
/* Enable GPIO at initial use */
2832-
if (pin->enable_count == 0)
2833-
gpiod_set_value_cansleep(pin->gpiod, 1);
2833+
if (pin->enable_count == 0) {
2834+
ret = gpiod_set_value_cansleep(pin->gpiod, 1);
2835+
if (ret)
2836+
return ret;
2837+
}
28342838

28352839
pin->enable_count++;
28362840
} else {
@@ -2841,7 +2845,10 @@ static int regulator_ena_gpio_ctrl(struct regulator_dev *rdev, bool enable)
28412845

28422846
/* Disable GPIO if not used */
28432847
if (pin->enable_count <= 1) {
2844-
gpiod_set_value_cansleep(pin->gpiod, 0);
2848+
ret = gpiod_set_value_cansleep(pin->gpiod, 0);
2849+
if (ret)
2850+
return ret;
2851+
28452852
pin->enable_count = 0;
28462853
}
28472854
}

drivers/regulator/fixed.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,10 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
330330

331331
drvdata->dev = devm_regulator_register(&pdev->dev, &drvdata->desc,
332332
&cfg);
333-
if (IS_ERR(drvdata->dev)) {
334-
ret = dev_err_probe(&pdev->dev, PTR_ERR(drvdata->dev),
335-
"Failed to register regulator: %ld\n",
336-
PTR_ERR(drvdata->dev));
337-
gpiod_put(cfg.ena_gpiod);
338-
return ret;
339-
}
333+
if (IS_ERR(drvdata->dev))
334+
return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->dev),
335+
"Failed to register regulator: %ld\n",
336+
PTR_ERR(drvdata->dev));
340337

341338
platform_set_drvdata(pdev, drvdata);
342339

drivers/regulator/spacemit-p1.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ static const struct linear_range p1_ldo_ranges[] = {
8787
}
8888

8989
#define P1_BUCK_DESC(_n) \
90-
P1_REG_DESC(BUCK, buck, _n, "vcc", 0x47, BUCK_MASK, 254, p1_buck_ranges)
90+
P1_REG_DESC(BUCK, buck, _n, "vin", 0x47, BUCK_MASK, 254, p1_buck_ranges)
9191

9292
#define P1_ALDO_DESC(_n) \
93-
P1_REG_DESC(ALDO, aldo, _n, "vcc", 0x5b, LDO_MASK, 117, p1_ldo_ranges)
93+
P1_REG_DESC(ALDO, aldo, _n, "vin", 0x5b, LDO_MASK, 117, p1_ldo_ranges)
9494

9595
#define P1_DLDO_DESC(_n) \
9696
P1_REG_DESC(DLDO, dldo, _n, "buck5", 0x67, LDO_MASK, 117, p1_ldo_ranges)

0 commit comments

Comments
 (0)