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

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
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -5542,6 +5542,8 @@ regulator_register(struct device *dev,
		goto rinse;
	}
	device_initialize(&rdev->dev);
	dev_set_drvdata(&rdev->dev, rdev);
	rdev->dev.class = &regulator_class;
	spin_lock_init(&rdev->err_lock);

	/*
@@ -5603,11 +5605,9 @@ regulator_register(struct device *dev,
		rdev->supply_name = regulator_desc->supply_name;

	/* register with sysfs */
	rdev->dev.class = &regulator_class;
	rdev->dev.parent = config->dev;
	dev_set_name(&rdev->dev, "regulator.%lu",
		    (unsigned long) atomic_inc_return(&regulator_no));
	dev_set_drvdata(&rdev->dev, rdev);

	/* set regulator constraints */
	if (init_data)
@@ -5724,15 +5724,11 @@ regulator_register(struct device *dev,
	mutex_lock(&regulator_list_mutex);
	regulator_ena_gpio_free(rdev);
	mutex_unlock(&regulator_list_mutex);
	put_device(&rdev->dev);
	rdev = NULL;
clean:
	if (dangling_of_gpiod)
		gpiod_put(config->ena_gpiod);
	if (rdev && rdev->dev.of_node)
		of_node_put(rdev->dev.of_node);
	kfree(rdev);
	kfree(config);
	put_device(&rdev->dev);
rinse:
	if (dangling_cfg_gpiod)
		gpiod_put(cfg->ena_gpiod);
+15 −3
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ struct mt6358_regulator_info {
	.desc = {	\
		.name = #vreg,	\
		.of_match = of_match_ptr(match),	\
		.ops = &mt6358_volt_range_ops,	\
		.ops = &mt6358_buck_ops,	\
		.type = REGULATOR_VOLTAGE,	\
		.id = MT6358_ID_##vreg,		\
		.owner = THIS_MODULE,		\
@@ -139,7 +139,7 @@ struct mt6358_regulator_info {
	.desc = {	\
		.name = #vreg,	\
		.of_match = of_match_ptr(match),	\
		.ops = &mt6358_volt_range_ops,	\
		.ops = &mt6358_buck_ops,	\
		.type = REGULATOR_VOLTAGE,	\
		.id = MT6366_ID_##vreg,		\
		.owner = THIS_MODULE,		\
@@ -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,
	.map_voltage = regulator_map_voltage_linear,
	.set_voltage_sel = regulator_set_voltage_sel_regmap,
@@ -464,6 +464,18 @@ static const struct regulator_ops mt6358_volt_range_ops = {
	.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 = {
	.list_voltage = regulator_list_voltage_table,
	.map_voltage = regulator_map_voltage_iterate,