Commit 7cccbeca authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'regulator-fix-v6.6-rc4' of...

Merge tag 'regulator-fix-v6.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator fixes from Mark Brown:
 "Two things here, one is an improved fix for issues around freeing
  devices when registration fails which replaces a half baked fix with a
  more complete one which uses the device model release() function
  properly.

  The other fix is a device specific fix for mt6358, the driver said
  that the LDOs supported mode configuration but this is not actually
  the case and could cause issues"

* tag 'regulator-fix-v6.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator/core: Revert "fix kobject release warning and memory leak in regulator_register()"
  regulator/core: regulator_register: set device->class earlier
  regulator: mt6358: split ops for buck and linear range LDO regulators
parents cdcb5d19 6e800968
...@@ -5542,6 +5542,8 @@ regulator_register(struct device *dev, ...@@ -5542,6 +5542,8 @@ regulator_register(struct device *dev,
goto rinse; goto rinse;
} }
device_initialize(&rdev->dev); device_initialize(&rdev->dev);
dev_set_drvdata(&rdev->dev, rdev);
rdev->dev.class = &regulator_class;
spin_lock_init(&rdev->err_lock); spin_lock_init(&rdev->err_lock);
/* /*
...@@ -5603,11 +5605,9 @@ regulator_register(struct device *dev, ...@@ -5603,11 +5605,9 @@ regulator_register(struct device *dev,
rdev->supply_name = regulator_desc->supply_name; rdev->supply_name = regulator_desc->supply_name;
/* register with sysfs */ /* register with sysfs */
rdev->dev.class = &regulator_class;
rdev->dev.parent = config->dev; rdev->dev.parent = config->dev;
dev_set_name(&rdev->dev, "regulator.%lu", dev_set_name(&rdev->dev, "regulator.%lu",
(unsigned long) atomic_inc_return(&regulator_no)); (unsigned long) atomic_inc_return(&regulator_no));
dev_set_drvdata(&rdev->dev, rdev);
/* set regulator constraints */ /* set regulator constraints */
if (init_data) if (init_data)
...@@ -5724,15 +5724,11 @@ regulator_register(struct device *dev, ...@@ -5724,15 +5724,11 @@ regulator_register(struct device *dev,
mutex_lock(&regulator_list_mutex); mutex_lock(&regulator_list_mutex);
regulator_ena_gpio_free(rdev); regulator_ena_gpio_free(rdev);
mutex_unlock(&regulator_list_mutex); mutex_unlock(&regulator_list_mutex);
put_device(&rdev->dev);
rdev = NULL;
clean: clean:
if (dangling_of_gpiod) if (dangling_of_gpiod)
gpiod_put(config->ena_gpiod); gpiod_put(config->ena_gpiod);
if (rdev && rdev->dev.of_node)
of_node_put(rdev->dev.of_node);
kfree(rdev);
kfree(config); kfree(config);
put_device(&rdev->dev);
rinse: rinse:
if (dangling_cfg_gpiod) if (dangling_cfg_gpiod)
gpiod_put(cfg->ena_gpiod); gpiod_put(cfg->ena_gpiod);
......
...@@ -43,7 +43,7 @@ struct mt6358_regulator_info { ...@@ -43,7 +43,7 @@ struct mt6358_regulator_info {
.desc = { \ .desc = { \
.name = #vreg, \ .name = #vreg, \
.of_match = of_match_ptr(match), \ .of_match = of_match_ptr(match), \
.ops = &mt6358_volt_range_ops, \ .ops = &mt6358_buck_ops, \
.type = REGULATOR_VOLTAGE, \ .type = REGULATOR_VOLTAGE, \
.id = MT6358_ID_##vreg, \ .id = MT6358_ID_##vreg, \
.owner = THIS_MODULE, \ .owner = THIS_MODULE, \
...@@ -139,7 +139,7 @@ struct mt6358_regulator_info { ...@@ -139,7 +139,7 @@ struct mt6358_regulator_info {
.desc = { \ .desc = { \
.name = #vreg, \ .name = #vreg, \
.of_match = of_match_ptr(match), \ .of_match = of_match_ptr(match), \
.ops = &mt6358_volt_range_ops, \ .ops = &mt6358_buck_ops, \
.type = REGULATOR_VOLTAGE, \ .type = REGULATOR_VOLTAGE, \
.id = MT6366_ID_##vreg, \ .id = MT6366_ID_##vreg, \
.owner = THIS_MODULE, \ .owner = THIS_MODULE, \
...@@ -450,7 +450,7 @@ static unsigned int mt6358_regulator_get_mode(struct regulator_dev *rdev) ...@@ -450,7 +450,7 @@ static unsigned int mt6358_regulator_get_mode(struct regulator_dev *rdev)
} }
} }
static const struct regulator_ops mt6358_volt_range_ops = { static const struct regulator_ops mt6358_buck_ops = {
.list_voltage = regulator_list_voltage_linear, .list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear, .map_voltage = regulator_map_voltage_linear,
.set_voltage_sel = regulator_set_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap,
...@@ -464,6 +464,18 @@ static const struct regulator_ops mt6358_volt_range_ops = { ...@@ -464,6 +464,18 @@ static const struct regulator_ops mt6358_volt_range_ops = {
.get_mode = mt6358_regulator_get_mode, .get_mode = mt6358_regulator_get_mode,
}; };
static const struct regulator_ops mt6358_volt_range_ops = {
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = mt6358_get_buck_voltage_sel,
.set_voltage_time_sel = regulator_set_voltage_time_sel,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
.get_status = mt6358_get_status,
};
static const struct regulator_ops mt6358_volt_table_ops = { static const struct regulator_ops mt6358_volt_table_ops = {
.list_voltage = regulator_list_voltage_table, .list_voltage = regulator_list_voltage_table,
.map_voltage = regulator_map_voltage_iterate, .map_voltage = regulator_map_voltage_iterate,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment