mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 00:21:59 +00:00
regulator: provide regulator_bulk_set_supply_names()
There are many regulator consumers who - before using the regulator bulk functions - set the supply names in regulator_bulk_data using a for loop. Let's provide a simple helper in the consumer API that allows users to do the same with a single function call. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Link: https://lore.kernel.org/r/20190830071740.4267-2-brgl@bgdev.pl Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
baedad4c35
commit
d0087e7271
@ -860,3 +860,24 @@ int regulator_get_current_limit_regmap(struct regulator_dev *rdev)
|
||||
return -EINVAL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regulator_get_current_limit_regmap);
|
||||
|
||||
/**
|
||||
* regulator_bulk_set_supply_names - initialize the 'supply' fields in an array
|
||||
* of regulator_bulk_data structs
|
||||
*
|
||||
* @consumers: array of regulator_bulk_data entries to initialize
|
||||
* @supply_names: array of supply name strings
|
||||
* @num_supplies: number of supply names to initialize
|
||||
*
|
||||
* Note: the 'consumers' array must be the size of 'num_supplies'.
|
||||
*/
|
||||
void regulator_bulk_set_supply_names(struct regulator_bulk_data *consumers,
|
||||
const char *const *supply_names,
|
||||
unsigned int num_supplies)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < num_supplies; i++)
|
||||
consumers[i].supply = supply_names[i];
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(regulator_bulk_set_supply_names);
|
||||
|
@ -281,6 +281,12 @@ void devm_regulator_unregister_notifier(struct regulator *regulator,
|
||||
void *regulator_get_drvdata(struct regulator *regulator);
|
||||
void regulator_set_drvdata(struct regulator *regulator, void *data);
|
||||
|
||||
/* misc helpers */
|
||||
|
||||
void regulator_bulk_set_supply_names(struct regulator_bulk_data *consumers,
|
||||
const char *const *supply_names,
|
||||
unsigned int num_supplies);
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
@ -580,6 +586,12 @@ static inline int regulator_list_voltage(struct regulator *regulator, unsigned s
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
void regulator_bulk_set_supply_names(struct regulator_bulk_data *consumers,
|
||||
const char *const *supply_names,
|
||||
unsigned int num_supplies)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static inline int regulator_set_voltage_triplet(struct regulator *regulator,
|
||||
|
Loading…
Reference in New Issue
Block a user