Messages in this thread | | | Date | Wed, 29 Nov 2017 18:29:45 +0000 | From | Mark Brown <> | Subject | Re: [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] | |