regulator: Fixes for v6.6
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. -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmUcWEQACgkQJNaLcl1U h9D23Af/Xw15NauCs//YJPTXMDQ2fKN2ozAT+/pMtGk6kU33xR8ww1VD74U1+L6D PCLuGaHDK+Ys4ieu+llrJGCPrkJRVjvlndbdGDrmyYERnpnY9VTHkcjZvQEjJTJL 2Z2kg4hjwcUPESHxz9lUeDVil3N+J4Z2qJkaMqEnXSK2j7fFh/N1uINuwBGKP/Se tfpecfVPfw8CtbLAn/E3c/UBS96E+sqAcibpIbp1faAbqqinCXCJB0RJWECoqkJH FU4szCe9NOjFF00epVYUMEcB3l5DxXWdmlc3kwZ4iSRU3arYCro+kwbbaychs9Ue 9d1dUUN6tz1Sk9OL83H1l+zBktIvKg== =69aY -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
7cccbeca90
@ -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 = ®ulator_class;
|
||||||
spin_lock_init(&rdev->err_lock);
|
spin_lock_init(&rdev->err_lock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -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 = ®ulator_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(®ulator_no));
|
(unsigned long) atomic_inc_return(®ulator_no));
|
||||||
dev_set_drvdata(&rdev->dev, rdev);
|
|
||||||
|
|
||||||
/* set regulator constraints */
|
/* set regulator constraints */
|
||||||
if (init_data)
|
if (init_data)
|
||||||
@ -5724,15 +5724,11 @@ wash:
|
|||||||
mutex_lock(®ulator_list_mutex);
|
mutex_lock(®ulator_list_mutex);
|
||||||
regulator_ena_gpio_free(rdev);
|
regulator_ena_gpio_free(rdev);
|
||||||
mutex_unlock(®ulator_list_mutex);
|
mutex_unlock(®ulator_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 {
|
|||||||
.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 {
|
|||||||
.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)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 = {
|
|||||||
.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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user