lkml.org 
[lkml]   [2017]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH v2 3/3] regulator: core: Balance coupled regulators voltages
On Wed, Oct 18, 2017 at 02:47:02PM +0200, Maciej Purski wrote:

> +static void regulator_lock_supply_parents(struct regulator_dev *rdev)
> +{
> + struct regulator_dev *supply = rdev_get_supply(rdev);
> +
> + if (supply)
> + regulator_lock_supply(supply);
> +}

These functions are fairly pointless as they're so small, and they're
misnamed as they only lock a single parent but the name suggests it's
going to lock multiple things (I'd expect all the coupled regulators or
something from the name).

> + /*
> + * If the regulator is coupled with other regulators, we have to
> + * balance their voltages to keep the max_spread constraint.
> + */
> + if (rdev->coupled_desc)
> + regulator_balance_coupled(rdev->coupled_desc);

Just put the check into regulator_balance_coupled() rather than doing it
at every call site.

> + /*
> + * If the regulator is coupled, return after changing consumer demands
> + * without changing voltage. This will be handled outside the function
> + * by regulator_balance_coupled()
> + */
> + if (rdev->coupled_desc)
> + goto out;
> +
> + ret = regulator_set_voltage_rdev(regulator->rdev, min_uV, max_uV);
> + if (ret < 0)
> + goto out2;

Where is the elsewhere? I'm worried this is going to make things more
confusing.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2017-11-29 19:30    [W:0.147 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site