regulator: core: Use a struct to pass in regulator runtime configuration
Rather than adding new arguments to regulator_register() every time we want to add a new bit of dynamic information at runtime change the function to take these via a struct. By doing this we avoid needing to do further changes like the recent addition of device tree support which required each regulator driver to be updated to take an additional parameter. The regulator_desc which should (mostly) be static data is still passed separately as most drivers are able to configure this statically at build time. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
1474e4dbca
commit
c172708d38
45 changed files with 331 additions and 120 deletions
|
@ -148,10 +148,12 @@ enum regulator_type {
|
|||
};
|
||||
|
||||
/**
|
||||
* struct regulator_desc - Regulator descriptor
|
||||
* struct regulator_desc - Static regulator descriptor
|
||||
*
|
||||
* Each regulator registered with the core is described with a structure of
|
||||
* this type.
|
||||
* Each regulator registered with the core is described with a
|
||||
* structure of this type and a struct regulator_config. This
|
||||
* structure contains the non-varying parts of the regulator
|
||||
* description.
|
||||
*
|
||||
* @name: Identifying name for the regulator.
|
||||
* @supply_name: Identifying the regulator supply
|
||||
|
@ -173,6 +175,26 @@ struct regulator_desc {
|
|||
struct module *owner;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct regulator_config - Dynamic regulator descriptor
|
||||
*
|
||||
* Each regulator registered with the core is described with a
|
||||
* structure of this type and a struct regulator_desc. This structure
|
||||
* contains the runtime variable parts of the regulator description.
|
||||
*
|
||||
* @dev: struct device for the regulator
|
||||
* @init_data: platform provided init data, passed through by driver
|
||||
* @driver_data: private regulator data
|
||||
* @of_node: OpenFirmware node to parse for device tree bindings (may be
|
||||
* NULL).
|
||||
*/
|
||||
struct regulator_config {
|
||||
struct device *dev;
|
||||
const struct regulator_init_data *init_data;
|
||||
void *driver_data;
|
||||
struct device_node *of_node;
|
||||
};
|
||||
|
||||
/*
|
||||
* struct regulator_dev
|
||||
*
|
||||
|
@ -212,8 +234,7 @@ struct regulator_dev {
|
|||
|
||||
struct regulator_dev *
|
||||
regulator_register(const struct regulator_desc *regulator_desc,
|
||||
struct device *dev, const struct regulator_init_data *init_data,
|
||||
void *driver_data, struct device_node *of_node);
|
||||
const struct regulator_config *config);
|
||||
void regulator_unregister(struct regulator_dev *rdev);
|
||||
|
||||
int regulator_notifier_call_chain(struct regulator_dev *rdev,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue