mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 07:01:23 +00:00
regulator: of: Add regulator desc param to of_get_regulator_init_data()
The of_get_regulator_init_data() function is used to extract the regulator init_data but information on how to extract certain data is defined in the static regulator descriptor (e.g: how to map the hardware operating modes). Add a const struct regulator_desc * parameter to the function signature so the parsing logic could use the information in the struct regulator_desc. of_get_regulator_init_data() relies on of_get_regulation_constraints() to actually extract the init_data so it has to pass the struct regulator_desc but that is modified on a later patch. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
87e1e0f29f
commit
072e78b12b
27 changed files with 130 additions and 92 deletions
|
@ -40,13 +40,15 @@ struct fixed_voltage_data {
|
|||
/**
|
||||
* of_get_fixed_voltage_config - extract fixed_voltage_config structure info
|
||||
* @dev: device requesting for fixed_voltage_config
|
||||
* @desc: regulator description
|
||||
*
|
||||
* Populates fixed_voltage_config structure by extracting data from device
|
||||
* tree node, returns a pointer to the populated structure of NULL if memory
|
||||
* alloc fails.
|
||||
*/
|
||||
static struct fixed_voltage_config *
|
||||
of_get_fixed_voltage_config(struct device *dev)
|
||||
of_get_fixed_voltage_config(struct device *dev,
|
||||
const struct regulator_desc *desc)
|
||||
{
|
||||
struct fixed_voltage_config *config;
|
||||
struct device_node *np = dev->of_node;
|
||||
|
@ -57,7 +59,7 @@ of_get_fixed_voltage_config(struct device *dev)
|
|||
if (!config)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
config->init_data = of_get_regulator_init_data(dev, dev->of_node);
|
||||
config->init_data = of_get_regulator_init_data(dev, dev->of_node, desc);
|
||||
if (!config->init_data)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
|
@ -112,8 +114,14 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
|
|||
struct regulator_config cfg = { };
|
||||
int ret;
|
||||
|
||||
drvdata = devm_kzalloc(&pdev->dev, sizeof(struct fixed_voltage_data),
|
||||
GFP_KERNEL);
|
||||
if (!drvdata)
|
||||
return -ENOMEM;
|
||||
|
||||
if (pdev->dev.of_node) {
|
||||
config = of_get_fixed_voltage_config(&pdev->dev);
|
||||
config = of_get_fixed_voltage_config(&pdev->dev,
|
||||
&drvdata->desc);
|
||||
if (IS_ERR(config))
|
||||
return PTR_ERR(config);
|
||||
} else {
|
||||
|
@ -123,11 +131,6 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
|
|||
if (!config)
|
||||
return -ENOMEM;
|
||||
|
||||
drvdata = devm_kzalloc(&pdev->dev, sizeof(struct fixed_voltage_data),
|
||||
GFP_KERNEL);
|
||||
if (!drvdata)
|
||||
return -ENOMEM;
|
||||
|
||||
drvdata->desc.name = devm_kstrdup(&pdev->dev,
|
||||
config->supply_name,
|
||||
GFP_KERNEL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue