aboutsummaryrefslogtreecommitdiff
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c310
1 files changed, 170 insertions, 140 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 7674b7f2df14..1179766811f5 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -139,6 +139,8 @@ static bool regulator_ops_is_valid(struct regulator_dev *rdev, int ops)
* once. If a task, which is calling this function is other
* than the one, which initially locked the mutex, it will
* wait on mutex.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
static inline int regulator_lock_nested(struct regulator_dev *rdev,
struct ww_acquire_ctx *ww_ctx)
@@ -419,72 +421,6 @@ static void regulator_lock_dependent(struct regulator_dev *rdev,
mutex_unlock(&regulator_list_mutex);
}
-/**
- * of_get_child_regulator - get a child regulator device node
- * based on supply name
- * @parent: Parent device node
- * @prop_name: Combination regulator supply name and "-supply"
- *
- * Traverse all child nodes.
- * Extract the child regulator device node corresponding to the supply name.
- * returns the device node corresponding to the regulator if found, else
- * returns NULL.
- */
-static struct device_node *of_get_child_regulator(struct device_node *parent,
- const char *prop_name)
-{
- struct device_node *regnode = NULL;
- struct device_node *child = NULL;
-
- for_each_child_of_node(parent, child) {
- regnode = of_parse_phandle(child, prop_name, 0);
-
- if (!regnode) {
- regnode = of_get_child_regulator(child, prop_name);
- if (regnode)
- goto err_node_put;
- } else {
- goto err_node_put;
- }
- }
- return NULL;
-
-err_node_put:
- of_node_put(child);
- return regnode;
-}
-
-/**
- * of_get_regulator - get a regulator device node based on supply name
- * @dev: Device pointer for the consumer (of regulator) device
- * @supply: regulator supply name
- *
- * Extract the regulator device node corresponding to the supply name.
- * returns the device node corresponding to the regulator if found, else
- * returns NULL.
- */
-static struct device_node *of_get_regulator(struct device *dev, const char *supply)
-{
- struct device_node *regnode = NULL;
- char prop_name[64]; /* 64 is max size of property name */
-
- dev_dbg(dev, "Looking up %s-supply from device tree\n", supply);
-
- snprintf(prop_name, 64, "%s-supply", supply);
- regnode = of_parse_phandle(dev->of_node, prop_name, 0);
-
- if (!regnode) {
- regnode = of_get_child_regulator(dev->of_node, prop_name);
- if (regnode)
- return regnode;
-
- dev_dbg(dev, "Looking up %s property in node %pOF failed\n",
- prop_name, dev->of_node);
- return NULL;
- }
- return regnode;
-}
-
/* Platform voltage constraint check */
int regulator_check_voltage(struct regulator_dev *rdev,
int *min_uV, int *max_uV)
@@ -1462,6 +1398,8 @@ static int handle_notify_limits(struct regulator_dev *rdev,
* Constraints *must* be set by platform code in order for some
* regulator operations to proceed i.e. set_voltage, set_current_limit,
* set_mode.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
static int set_machine_constraints(struct regulator_dev *rdev)
{
@@ -1700,6 +1638,8 @@ static int set_machine_constraints(struct regulator_dev *rdev)
* Called by platform initialisation code to set the supply regulator for this
* regulator. This ensures that a regulators supply will also be enabled by the
* core if it's child is enabled.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
static int set_supply(struct regulator_dev *rdev,
struct regulator_dev *supply_rdev)
@@ -1732,6 +1672,8 @@ static int set_supply(struct regulator_dev *rdev,
* sources to symbolic names for supplies for use by devices. Devices
* should use these symbolic names to request regulators, avoiding the
* need to provide board-specific regulator names as platform data.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
static int set_consumer_device_supply(struct regulator_dev *rdev,
const char *consumer_dev_name,
@@ -1998,18 +1940,19 @@ static struct regulator_dev *regulator_lookup_by_name(const char *name)
* @dev: device for regulator "consumer".
* @supply: Supply name or regulator ID.
*
+ * Return: pointer to &struct regulator_dev or ERR_PTR() encoded negative error number.
+ *
* If successful, returns a struct regulator_dev that corresponds to the name
* @supply and with the embedded struct device refcount incremented by one.
* The refcount must be dropped by calling put_device().
- * On failure one of the following ERR-PTR-encoded values is returned:
- * -ENODEV if lookup fails permanently, -EPROBE_DEFER if lookup could succeed
+ * On failure one of the following ERR_PTR() encoded values is returned:
+ * -%ENODEV if lookup fails permanently, -%EPROBE_DEFER if lookup could succeed
* in the future.
*/
static struct regulator_dev *regulator_dev_lookup(struct device *dev,
const char *supply)
{
struct regulator_dev *r = NULL;
- struct device_node *node;
struct regulator_map *map;
const char *devname = NULL;
@@ -2017,19 +1960,14 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev,
/* first do a dt based lookup */
if (dev && dev->of_node) {
- node = of_get_regulator(dev, supply);
- if (node) {
- r = of_find_regulator_by_node(node);
- of_node_put(node);
- if (r)
- return r;
+ r = of_regulator_dev_lookup(dev, supply);
+ if (!IS_ERR(r))
+ return r;
+ if (PTR_ERR(r) == -EPROBE_DEFER)
+ return r;
- /*
- * We have a node, but there is no device.
- * assume it has not registered yet.
- */
- return ERR_PTR(-EPROBE_DEFER);
- }
+ if (PTR_ERR(r) == -ENODEV)
+ r = NULL;
}
/* if not found, try doing it non-dt way */
@@ -2168,26 +2106,43 @@ out:
return ret;
}
-/* Internal regulator request function */
-struct regulator *_regulator_get(struct device *dev, const char *id,
- enum regulator_get_type get_type)
+/* common pre-checks for regulator requests */
+int _regulator_get_common_check(struct device *dev, const char *id,
+ enum regulator_get_type get_type)
{
- struct regulator_dev *rdev;
- struct regulator *regulator;
- struct device_link *link;
- int ret;
-
if (get_type >= MAX_GET_TYPE) {
dev_err(dev, "invalid type %d in %s\n", get_type, __func__);
- return ERR_PTR(-EINVAL);
+ return -EINVAL;
}
if (id == NULL) {
- pr_err("get() with no identifier\n");
- return ERR_PTR(-EINVAL);
+ dev_err(dev, "regulator request with no identifier\n");
+ return -EINVAL;
}
- rdev = regulator_dev_lookup(dev, id);
+ return 0;
+}
+
+/**
+ * _regulator_get_common - Common code for regulator requests
+ * @rdev: regulator device pointer as returned by *regulator_dev_lookup()
+ * Its reference count is expected to have been incremented.
+ * @dev: device used for dev_printk messages
+ * @id: Supply name or regulator ID
+ * @get_type: enum regulator_get_type value corresponding to type of request
+ *
+ * Returns: pointer to struct regulator corresponding to @rdev, or ERR_PTR()
+ * encoded error.
+ *
+ * This function should be chained with *regulator_dev_lookup() functions.
+ */
+struct regulator *_regulator_get_common(struct regulator_dev *rdev, struct device *dev,
+ const char *id, enum regulator_get_type get_type)
+{
+ struct regulator *regulator;
+ struct device_link *link;
+ int ret;
+
if (IS_ERR(rdev)) {
ret = PTR_ERR(rdev);
@@ -2303,18 +2258,33 @@ struct regulator *_regulator_get(struct device *dev, const char *id,
return regulator;
}
+/* Internal regulator request function */
+struct regulator *_regulator_get(struct device *dev, const char *id,
+ enum regulator_get_type get_type)
+{
+ struct regulator_dev *rdev;
+ int ret;
+
+ ret = _regulator_get_common_check(dev, id, get_type);
+ if (ret)
+ return ERR_PTR(ret);
+
+ rdev = regulator_dev_lookup(dev, id);
+ return _regulator_get_common(rdev, dev, id, get_type);
+}
+
/**
* regulator_get - lookup and obtain a reference to a regulator.
* @dev: device for regulator "consumer"
* @id: Supply name or regulator ID.
*
- * Returns a struct regulator corresponding to the regulator producer,
- * or IS_ERR() condition containing errno.
- *
* Use of supply names configured via set_consumer_device_supply() is
* strongly encouraged. It is recommended that the supply name used
* should match the name used for the supply and/or the relevant
* device pins in the datasheet.
+ *
+ * Return: Pointer to a &struct regulator corresponding to the regulator
+ * producer, or an ERR_PTR() encoded negative error number.
*/
struct regulator *regulator_get(struct device *dev, const char *id)
{
@@ -2327,11 +2297,9 @@ EXPORT_SYMBOL_GPL(regulator_get);
* @dev: device for regulator "consumer"
* @id: Supply name or regulator ID.
*
- * Returns a struct regulator corresponding to the regulator producer,
- * or IS_ERR() condition containing errno. Other consumers will be
- * unable to obtain this regulator while this reference is held and the
- * use count for the regulator will be initialised to reflect the current
- * state of the regulator.
+ * Other consumers will be unable to obtain this regulator while this
+ * reference is held and the use count for the regulator will be
+ * initialised to reflect the current state of the regulator.
*
* This is intended for use by consumers which cannot tolerate shared
* use of the regulator such as those which need to force the
@@ -2342,6 +2310,9 @@ EXPORT_SYMBOL_GPL(regulator_get);
* strongly encouraged. It is recommended that the supply name used
* should match the name used for the supply and/or the relevant
* device pins in the datasheet.
+ *
+ * Return: Pointer to a &struct regulator corresponding to the regulator
+ * producer, or an ERR_PTR() encoded negative error number.
*/
struct regulator *regulator_get_exclusive(struct device *dev, const char *id)
{
@@ -2354,9 +2325,6 @@ EXPORT_SYMBOL_GPL(regulator_get_exclusive);
* @dev: device for regulator "consumer"
* @id: Supply name or regulator ID.
*
- * Returns a struct regulator corresponding to the regulator producer,
- * or IS_ERR() condition containing errno.
- *
* This is intended for use by consumers for devices which can have
* some supplies unconnected in normal use, such as some MMC devices.
* It can allow the regulator core to provide stub supplies for other
@@ -2368,6 +2336,9 @@ EXPORT_SYMBOL_GPL(regulator_get_exclusive);
* strongly encouraged. It is recommended that the supply name used
* should match the name used for the supply and/or the relevant
* device pins in the datasheet.
+ *
+ * Return: Pointer to a &struct regulator corresponding to the regulator
+ * producer, or an ERR_PTR() encoded negative error number.
*/
struct regulator *regulator_get_optional(struct device *dev, const char *id)
{
@@ -2448,6 +2419,8 @@ EXPORT_SYMBOL_GPL(regulator_put);
*
* All lookups for id on dev will instead be conducted for alias_id on
* alias_dev.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_register_supply_alias(struct device *dev, const char *id,
struct device *alias_dev,
@@ -2507,12 +2480,12 @@ EXPORT_SYMBOL_GPL(regulator_unregister_supply_alias);
* lookup the supply
* @num_id: Number of aliases to register
*
- * @return 0 on success, an errno on failure.
- *
* This helper function allows drivers to register several supply
* aliases in one operation. If any of the aliases cannot be
* registered any aliases that were registered will be removed
* before returning to the caller.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_bulk_register_supply_alias(struct device *dev,
const char *const *id,
@@ -2637,6 +2610,8 @@ static void regulator_ena_gpio_free(struct regulator_dev *rdev)
*
* GPIO is enabled in case of initial use. (enable_count is 0)
* GPIO is disabled when it is not shared any more. (enable_count <= 1)
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
static int regulator_ena_gpio_ctrl(struct regulator_dev *rdev, bool enable)
{
@@ -2707,10 +2682,8 @@ static void _regulator_delay_helper(unsigned int delay)
}
/**
- * _regulator_check_status_enabled
- *
- * A helper function to check if the regulator status can be interpreted
- * as 'regulator is enabled'.
+ * _regulator_check_status_enabled - check if regulator status can be
+ * interpreted as "regulator is enabled"
* @rdev: the regulator device to check
*
* Return:
@@ -2839,7 +2812,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
* responsible for keeping track of the refcount for a given regulator consumer
* and applying / unapplying these things.
*
- * Returns 0 upon no error; -error upon error.
+ * Return: 0 on success or negative error number on failure.
*/
static int _regulator_handle_consumer_enable(struct regulator *regulator)
{
@@ -2865,7 +2838,7 @@ static int _regulator_handle_consumer_enable(struct regulator *regulator)
*
* The opposite of _regulator_handle_consumer_enable().
*
- * Returns 0 upon no error; -error upon error.
+ * Return: 0 on success or a negative error number on failure.
*/
static int _regulator_handle_consumer_disable(struct regulator *regulator)
{
@@ -2961,6 +2934,8 @@ err_disable_supply:
*
* NOTE: the output value can be set by other drivers, boot loader or may be
* hardwired in the regulator.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_enable(struct regulator *regulator)
{
@@ -3071,6 +3046,8 @@ static int _regulator_disable(struct regulator *regulator)
* NOTE: this will only disable the regulator output if no other consumer
* devices have it enabled, the regulator device supports disabling and
* machine constraints permit this operation.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_disable(struct regulator *regulator)
{
@@ -3120,6 +3097,8 @@ static int _regulator_force_disable(struct regulator_dev *rdev)
* NOTE: this *will* disable the regulator output even if other consumer
* devices have it enabled. This should be used for situations when device
* damage will likely occur if the regulator is not disabled (e.g. over temp).
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_force_disable(struct regulator *regulator)
{
@@ -3202,6 +3181,8 @@ static void regulator_disable_work(struct work_struct *work)
* NOTE: this will only disable the regulator output if no other consumer
* devices have it enabled, the regulator device supports disabling and
* machine constraints permit this operation.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_disable_deferred(struct regulator *regulator, int ms)
{
@@ -3273,13 +3254,13 @@ static int _regulator_list_voltage(struct regulator_dev *rdev,
* regulator_is_enabled - is the regulator output enabled
* @regulator: regulator source
*
- * Returns positive if the regulator driver backing the source/client
- * has requested that the device be enabled, zero if it hasn't, else a
- * negative errno code.
- *
* Note that the device backing this regulator handle can have multiple
* users, so it might be enabled even if regulator_enable() was never
* called for this particular source.
+ *
+ * Return: Positive if the regulator driver backing the source/client
+ * has requested that the device be enabled, zero if it hasn't,
+ * else a negative error number.
*/
int regulator_is_enabled(struct regulator *regulator)
{
@@ -3300,9 +3281,10 @@ EXPORT_SYMBOL_GPL(regulator_is_enabled);
* regulator_count_voltages - count regulator_list_voltage() selectors
* @regulator: regulator source
*
- * Returns number of selectors, or negative errno. Selectors are
- * numbered starting at zero, and typically correspond to bitfields
- * in hardware registers.
+ * Return: Number of selectors for @regulator, or negative error number.
+ *
+ * Selectors are numbered starting at zero, and typically correspond to
+ * bitfields in hardware registers.
*/
int regulator_count_voltages(struct regulator *regulator)
{
@@ -3324,9 +3306,9 @@ EXPORT_SYMBOL_GPL(regulator_count_voltages);
* @selector: identify voltage to list
* Context: can sleep
*
- * Returns a voltage that can be passed to @regulator_set_voltage(),
- * zero if this selector code can't be used on this system, or a
- * negative errno.
+ * Return: Voltage for @selector that can be passed to regulator_set_voltage(),
+ * 0 if @selector can't be used on this system, or a negative error
+ * number on failure.
*/
int regulator_list_voltage(struct regulator *regulator, unsigned selector)
{
@@ -3338,8 +3320,8 @@ EXPORT_SYMBOL_GPL(regulator_list_voltage);
* regulator_get_regmap - get the regulator's register map
* @regulator: regulator source
*
- * Returns the register map for the given regulator, or an ERR_PTR value
- * if the regulator doesn't use regmap.
+ * Return: Pointer to the &struct regmap for @regulator, or ERR_PTR()
+ * encoded -%EOPNOTSUPP if @regulator doesn't use regmap.
*/
struct regmap *regulator_get_regmap(struct regulator *regulator)
{
@@ -3360,8 +3342,11 @@ EXPORT_SYMBOL_GPL(regulator_get_regmap);
* hardware or firmware that can make I2C requests behind the kernel's back,
* for example.
*
+ * Return: 0 on success, or -%EOPNOTSUPP if the regulator does not support
+ * voltage selectors.
+ *
* On success, the output parameters @vsel_reg and @vsel_mask are filled in
- * and 0 is returned, otherwise a negative errno is returned.
+ * and 0 is returned, otherwise a negative error number is returned.
*/
int regulator_get_hardware_vsel_register(struct regulator *regulator,
unsigned *vsel_reg,
@@ -3389,7 +3374,9 @@ EXPORT_SYMBOL_GPL(regulator_get_hardware_vsel_register);
* directly written to the regulator registers. The address of the voltage
* register can be determined by calling @regulator_get_hardware_vsel_register.
*
- * On error a negative errno is returned.
+ * Return: 0 on success, -%EINVAL if the selector is outside the supported
+ * range, or -%EOPNOTSUPP if the regulator does not support voltage
+ * selectors.
*/
int regulator_list_hardware_vsel(struct regulator *regulator,
unsigned selector)
@@ -3416,7 +3403,7 @@ EXPORT_SYMBOL_GPL(regulator_list_hardware_vsel);
* Request that the regulator be enabled/disabled with the regulator output at
* the predefined voltage or current value.
*
- * On success 0 is returned, otherwise a negative errno is returned.
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_hardware_enable(struct regulator *regulator, bool enable)
{
@@ -3440,8 +3427,8 @@ EXPORT_SYMBOL_GPL(regulator_hardware_enable);
* regulator_get_linear_step - return the voltage step size between VSEL values
* @regulator: regulator source
*
- * Returns the voltage step size between VSEL values for linear
- * regulators, or return 0 if the regulator isn't a linear regulator.
+ * Return: The voltage step size between VSEL values for linear regulators,
+ * or 0 if the regulator isn't a linear regulator.
*/
unsigned int regulator_get_linear_step(struct regulator *regulator)
{
@@ -3458,7 +3445,9 @@ EXPORT_SYMBOL_GPL(regulator_get_linear_step);
* @min_uV: Minimum required voltage in uV.
* @max_uV: Maximum required voltage in uV.
*
- * Returns a boolean.
+ * Return: 1 if the voltage range is supported, 0 if not, or a negative error
+ * number if @regulator's voltage can't be changed and voltage readback
+ * failed.
*/
int regulator_is_supported_voltage(struct regulator *regulator,
int min_uV, int max_uV)
@@ -4210,6 +4199,8 @@ static int regulator_balance_voltage(struct regulator_dev *rdev,
* request voltage that meets the system constraints will be used.
* Regulator system constraints must be set for this regulator before
* calling this function otherwise this call will fail.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
{
@@ -4320,6 +4311,8 @@ EXPORT_SYMBOL_GPL(regulator_set_suspend_voltage);
* Provided with the starting and ending voltage, this function attempts to
* calculate the time in microseconds required to rise or fall to this new
* voltage.
+ *
+ * Return: ramp time in microseconds, or a negative error number if calculation failed.
*/
int regulator_set_voltage_time(struct regulator *regulator,
int old_uV, int new_uV)
@@ -4377,6 +4370,8 @@ EXPORT_SYMBOL_GPL(regulator_set_voltage_time);
*
* Drivers providing ramp_delay in regulation_constraints can use this as their
* set_voltage_time_sel() operation.
+ *
+ * Return: ramp time in microseconds, or a negative error number if calculation failed.
*/
int regulator_set_voltage_time_sel(struct regulator_dev *rdev,
unsigned int old_selector,
@@ -4429,6 +4424,8 @@ out:
* Re-apply the last configured voltage. This is intended to be used
* where some external control source the consumer is cooperating with
* has caused the configured voltage to change.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_sync_voltage(struct regulator *regulator)
{
@@ -4527,7 +4524,7 @@ EXPORT_SYMBOL_GPL(regulator_get_voltage_rdev);
* regulator_get_voltage - get regulator output voltage
* @regulator: regulator source
*
- * This returns the current regulator voltage in uV.
+ * Return: Current regulator voltage in uV, or a negative error number on failure.
*
* NOTE: If the regulator is disabled it will return the voltage value. This
* function should not be used to determine regulator state.
@@ -4560,6 +4557,8 @@ EXPORT_SYMBOL_GPL(regulator_get_voltage);
*
* NOTE: Regulator system constraints must be set for this regulator before
* calling this function otherwise this call will fail.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_set_current_limit(struct regulator *regulator,
int min_uA, int max_uA)
@@ -4611,7 +4610,8 @@ static int _regulator_get_current_limit(struct regulator_dev *rdev)
* regulator_get_current_limit - get regulator output current
* @regulator: regulator source
*
- * This returns the current supplied by the specified current sink in uA.
+ * Return: Current supplied by the specified current sink in uA,
+ * or a negative error number on failure.
*
* NOTE: If the regulator is disabled it will return the current value. This
* function should not be used to determine regulator state.
@@ -4632,6 +4632,8 @@ EXPORT_SYMBOL_GPL(regulator_get_current_limit);
*
* NOTE: Regulator system constraints must be set for this regulator before
* calling this function otherwise this call will fail.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_set_mode(struct regulator *regulator, unsigned int mode)
{
@@ -4693,6 +4695,9 @@ static unsigned int _regulator_get_mode(struct regulator_dev *rdev)
* @regulator: regulator source
*
* Get the current regulator operating mode.
+ *
+ * Return: Current operating mode as %REGULATOR_MODE_* values,
+ * or a negative error number on failure.
*/
unsigned int regulator_get_mode(struct regulator *regulator)
{
@@ -4739,6 +4744,8 @@ static int _regulator_get_error_flags(struct regulator_dev *rdev,
* @flags: pointer to store error flags
*
* Get the current regulator error information.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_get_error_flags(struct regulator *regulator,
unsigned int *flags)
@@ -4779,7 +4786,7 @@ EXPORT_SYMBOL_GPL(regulator_get_error_flags);
* If a regulator is an always-on regulator then an individual consumer's
* load will still be removed if that consumer is fully disabled.
*
- * On error a negative errno is returned.
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_set_load(struct regulator *regulator, int uA_load)
{
@@ -4811,6 +4818,9 @@ EXPORT_SYMBOL_GPL(regulator_set_load);
* for the regulator also enable bypass mode and the machine
* constraints allow this. Bypass mode means that the regulator is
* simply passing the input directly to the output with no regulation.
+ *
+ * Return: 0 on success or if changing bypass is not possible, or
+ * a negative error number on failure.
*/
int regulator_allow_bypass(struct regulator *regulator, bool enable)
{
@@ -4868,6 +4878,8 @@ EXPORT_SYMBOL_GPL(regulator_allow_bypass);
* @nb: notifier block
*
* Register notifier block to receive regulator events.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_register_notifier(struct regulator *regulator,
struct notifier_block *nb)
@@ -4883,6 +4895,8 @@ EXPORT_SYMBOL_GPL(regulator_register_notifier);
* @nb: notifier block
*
* Unregister regulator event notifier block.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_unregister_notifier(struct regulator *regulator,
struct notifier_block *nb)
@@ -4964,12 +4978,12 @@ err:
* @num_consumers: Number of consumers to register
* @consumers: Configuration of consumers; clients are stored here.
*
- * @return 0 on success, an errno on failure.
- *
* This helper function allows drivers to get several regulator
* consumers in one operation. If any of the regulators cannot be
* acquired then any regulators that were allocated will be freed
* before returning to the caller.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_bulk_get(struct device *dev, int num_consumers,
struct regulator_bulk_data *consumers)
@@ -4990,12 +5004,13 @@ static void regulator_bulk_enable_async(void *data, async_cookie_t cookie)
*
* @num_consumers: Number of consumers
* @consumers: Consumer data; clients are stored here.
- * @return 0 on success, an errno on failure
*
* This convenience API allows consumers to enable multiple regulator
* clients in a single API call. If any consumers cannot be enabled
* then any others that were enabled will be disabled again prior to
* return.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_bulk_enable(int num_consumers,
struct regulator_bulk_data *consumers)
@@ -5039,12 +5054,13 @@ EXPORT_SYMBOL_GPL(regulator_bulk_enable);
*
* @num_consumers: Number of consumers
* @consumers: Consumer data; clients are stored here.
- * @return 0 on success, an errno on failure
*
* This convenience API allows consumers to disable multiple regulator
* clients in a single API call. If any consumers cannot be disabled
* then any others that were disabled will be enabled again prior to
* return.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_bulk_disable(int num_consumers,
struct regulator_bulk_data *consumers)
@@ -5078,7 +5094,6 @@ EXPORT_SYMBOL_GPL(regulator_bulk_disable);
*
* @num_consumers: Number of consumers
* @consumers: Consumer data; clients are stored here.
- * @return 0 on success, an errno on failure
*
* This convenience API allows consumers to forcibly disable multiple regulator
* clients in a single API call.
@@ -5086,6 +5101,8 @@ EXPORT_SYMBOL_GPL(regulator_bulk_disable);
* likely occur if the regulators are not disabled (e.g. over temp).
* Although regulator_force_disable function call for some consumers can
* return error numbers, the function is called for all consumers.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
int regulator_bulk_force_disable(int num_consumers,
struct regulator_bulk_data *consumers)
@@ -5170,6 +5187,8 @@ static void regulator_handle_critical(struct regulator_dev *rdev,
*
* Called by regulator drivers to notify clients a regulator event has
* occurred.
+ *
+ * Return: %NOTIFY_DONE.
*/
int regulator_notifier_call_chain(struct regulator_dev *rdev,
unsigned long event, void *data)
@@ -5188,6 +5207,8 @@ EXPORT_SYMBOL_GPL(regulator_notifier_call_chain);
* @mode: Mode to convert
*
* Convert a regulator mode into a status.
+ *
+ * Return: %REGULATOR_STATUS_* value corresponding to given mode.
*/
int regulator_mode_to_status(unsigned int mode)
{
@@ -5582,8 +5603,9 @@ static struct regulator_coupler generic_regulator_coupler = {
* @cfg: runtime configuration for regulator
*
* Called by regulator drivers to register a regulator.
- * Returns a valid pointer to struct regulator_dev on success
- * or an ERR_PTR() on error.
+ *
+ * Return: Pointer to a valid &struct regulator_dev on success or
+ * an ERR_PTR() encoded negative error number on failure.
*/
struct regulator_dev *
regulator_register(struct device *dev,
@@ -5877,6 +5899,8 @@ EXPORT_SYMBOL_GPL(regulator_unregister);
* @dev: ``&struct device`` pointer that is passed to _regulator_suspend()
*
* Configure each regulator with it's suspend operating parameters for state.
+ *
+ * Return: 0 on success or a negative error number on failure.
*/
static int regulator_suspend(struct device *dev)
{
@@ -5966,6 +5990,8 @@ EXPORT_SYMBOL_GPL(regulator_has_full_constraints);
*
* Get rdev regulator driver private data. This call can be used in the
* regulator driver context.
+ *
+ * Return: Pointer to regulator driver private data.
*/
void *rdev_get_drvdata(struct regulator_dev *rdev)
{
@@ -5979,6 +6005,8 @@ EXPORT_SYMBOL_GPL(rdev_get_drvdata);
*
* Get regulator driver private data. This call can be used in the consumer
* driver context when non API regulator specific functions need to be called.
+ *
+ * Return: Pointer to regulator driver private data.
*/
void *regulator_get_drvdata(struct regulator *regulator)
{
@@ -6000,6 +6028,8 @@ EXPORT_SYMBOL_GPL(regulator_set_drvdata);
/**
* rdev_get_id - get regulator ID
* @rdev: regulator
+ *
+ * Return: Regulator ID for @rdev.
*/
int rdev_get_id(struct regulator_dev *rdev)
{