History

Merge tag 'regulator-v3.19-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator fixes from Mark Brown: "One correctness fix here for the s2mps11 driver which would have resulted in some of the regulators being completely broken together with a fix for locking in regualtor_put() (which is fortunately rarely called at all in practical systems)" * tag 'regulator-v3.19-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: s2mps11: Fix wrong calculation of register offset regulator: core: fix race condition in regulator_put()

Linus Torvalds committed 11 years ago

Commit abe3b262 parents 8d6b932 113620b3 files · +43 −5Browse files

Unified · Split

3 files
  1. drivers/regulator/core.c +3 −1
  2. drivers/regulator/s2mps11.c +38 −4
  3. include/linux/mfd/samsung/s2mps13.h +2 −0
drivers/regulator/core.c+3−1
@@ -1488,7 +1488,7 @@ struct regulator *regulator_get_optional(struct device *dev, const char *id) · 1487 unmodified lines
1488}1488}
1489EXPORT_SYMBOL_GPL(regulator_get_optional);1489EXPORT_SYMBOL_GPL(regulator_get_optional);
1490 1490
1491/* Locks held by regulator_put() */1491/* regulator_list_mutex lock held by regulator_put() */
1492static void _regulator_put(struct regulator *regulator)1492static void _regulator_put(struct regulator *regulator)
1493{1493{
1494 struct regulator_dev *rdev;1494 struct regulator_dev *rdev;
@@ -1503,12 +1503,14 @@ static void _regulator_put(struct regulator *regulator) · 8 unmodified lines
1503 /* remove any sysfs entries */1503 /* remove any sysfs entries */
1504 if (regulator->dev)1504 if (regulator->dev)
1505 sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name);1505 sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name);
1506 mutex_lock(&rdev->mutex);
1506 kfree(regulator->supply_name);1507 kfree(regulator->supply_name);
1507 list_del(&regulator->list);1508 list_del(&regulator->list);
1508 kfree(regulator);1509 kfree(regulator);
1509 1510
1510 rdev->open_count--;1511 rdev->open_count--;
1511 rdev->exclusive = 0;1512 rdev->exclusive = 0;
1513 mutex_unlock(&rdev->mutex);
1512 1514
1513 module_put(rdev->owner);1515 module_put(rdev->owner);
1514}1516}
drivers/regulator/s2mps11.c+38−4
@@ -405,6 +405,40 @@ static struct regulator_ops s2mps14_reg_ops; · 404 unmodified lines
405 .enable_mask = S2MPS14_ENABLE_MASK \405 .enable_mask = S2MPS14_ENABLE_MASK \
406}406}
407 407
408#define regulator_desc_s2mps13_buck7(num, min, step, min_sel) { \
409 .name = "BUCK"#num, \
410 .id = S2MPS13_BUCK##num, \
411 .ops = &s2mps14_reg_ops, \
412 .type = REGULATOR_VOLTAGE, \
413 .owner = THIS_MODULE, \
414 .min_uV = min, \
415 .uV_step = step, \
416 .linear_min_sel = min_sel, \
417 .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \
418 .ramp_delay = S2MPS13_BUCK_RAMP_DELAY, \
419 .vsel_reg = S2MPS13_REG_B1OUT + (num) * 2 - 1, \
420 .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \
421 .enable_reg = S2MPS13_REG_B1CTRL + (num - 1) * 2, \
422 .enable_mask = S2MPS14_ENABLE_MASK \
423}
424
425#define regulator_desc_s2mps13_buck8_10(num, min, step, min_sel) { \
426 .name = "BUCK"#num, \
427 .id = S2MPS13_BUCK##num, \
428 .ops = &s2mps14_reg_ops, \
429 .type = REGULATOR_VOLTAGE, \
430 .owner = THIS_MODULE, \
431 .min_uV = min, \
432 .uV_step = step, \
433 .linear_min_sel = min_sel, \
434 .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \
435 .ramp_delay = S2MPS13_BUCK_RAMP_DELAY, \
436 .vsel_reg = S2MPS13_REG_B1OUT + (num) * 2 - 1, \
437 .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \
438 .enable_reg = S2MPS13_REG_B1CTRL + (num) * 2 - 1, \
439 .enable_mask = S2MPS14_ENABLE_MASK \
440}
441
408static const struct regulator_desc s2mps13_regulators[] = {442static const struct regulator_desc s2mps13_regulators[] = {
409 regulator_desc_s2mps13_ldo(1, MIN_800_MV, STEP_12_5_MV, 0x00),443 regulator_desc_s2mps13_ldo(1, MIN_800_MV, STEP_12_5_MV, 0x00),
410 regulator_desc_s2mps13_ldo(2, MIN_1400_MV, STEP_50_MV, 0x0C),444 regulator_desc_s2mps13_ldo(2, MIN_1400_MV, STEP_50_MV, 0x0C),
@@ -452,10 +486,10 @@ static const struct regulator_desc s2mps13_regulators[] = { · 41 unmodified lines
452 regulator_desc_s2mps13_buck(4, MIN_500_MV, STEP_6_25_MV, 0x10),486 regulator_desc_s2mps13_buck(4, MIN_500_MV, STEP_6_25_MV, 0x10),
453 regulator_desc_s2mps13_buck(5, MIN_500_MV, STEP_6_25_MV, 0x10),487 regulator_desc_s2mps13_buck(5, MIN_500_MV, STEP_6_25_MV, 0x10),
454 regulator_desc_s2mps13_buck(6, MIN_500_MV, STEP_6_25_MV, 0x10),488 regulator_desc_s2mps13_buck(6, MIN_500_MV, STEP_6_25_MV, 0x10),
455 regulator_desc_s2mps13_buck(7, MIN_500_MV, STEP_6_25_MV, 0x10),489 regulator_desc_s2mps13_buck7(7, MIN_500_MV, STEP_6_25_MV, 0x10),
456 regulator_desc_s2mps13_buck(8, MIN_1000_MV, STEP_12_5_MV, 0x20),490 regulator_desc_s2mps13_buck8_10(8, MIN_1000_MV, STEP_12_5_MV, 0x20),
457 regulator_desc_s2mps13_buck(9, MIN_1000_MV, STEP_12_5_MV, 0x20),491 regulator_desc_s2mps13_buck8_10(9, MIN_1000_MV, STEP_12_5_MV, 0x20),
458 regulator_desc_s2mps13_buck(10, MIN_500_MV, STEP_6_25_MV, 0x10),492 regulator_desc_s2mps13_buck8_10(10, MIN_500_MV, STEP_6_25_MV, 0x10),
459};493};
460 494
461static int s2mps14_regulator_enable(struct regulator_dev *rdev)495static int s2mps14_regulator_enable(struct regulator_dev *rdev)
include/linux/mfd/samsung/s2mps13.h+2−0
@@ -59,6 +59,7 @@ enum s2mps13_reg { · 58 unmodified lines
59 S2MPS13_REG_B6CTRL,59 S2MPS13_REG_B6CTRL,
60 S2MPS13_REG_B6OUT,60 S2MPS13_REG_B6OUT,
61 S2MPS13_REG_B7CTRL,61 S2MPS13_REG_B7CTRL,
62 S2MPS13_REG_B7SW,
62 S2MPS13_REG_B7OUT,63 S2MPS13_REG_B7OUT,
63 S2MPS13_REG_B8CTRL,64 S2MPS13_REG_B8CTRL,
64 S2MPS13_REG_B8OUT,65 S2MPS13_REG_B8OUT,
@@ -102,6 +103,7 @@ enum s2mps13_reg { · 37 unmodified lines
102 S2MPS13_REG_L26CTRL,103 S2MPS13_REG_L26CTRL,
103 S2MPS13_REG_L27CTRL,104 S2MPS13_REG_L27CTRL,
104 S2MPS13_REG_L28CTRL,105 S2MPS13_REG_L28CTRL,
106 S2MPS13_REG_L29CTRL,
105 S2MPS13_REG_L30CTRL,107 S2MPS13_REG_L30CTRL,
106 S2MPS13_REG_L31CTRL,108 S2MPS13_REG_L31CTRL,
107 S2MPS13_REG_L32CTRL,109 S2MPS13_REG_L32CTRL,