[PATCH v3 3/6] regulator: core: Add helper for allow access to enable register

Mark Brown broonie at kernel.org
Fri Jun 14 07:31:45 PDT 2024


On Fri, Jun 14, 2024 at 11:43:39AM +0000, Biju Das wrote:

> To access the hardware register for enabling/disabling the regulator,
> consumers must use regulator_get_exclusive(), as it can't work if there's
> more than one consumer. To enable/disable regulator use::

>        int regulator_hardware_enable(struct regulator *regulator, bool enable);

We should also enforce this.

> OK, will remove the restriction

> -       if (enable) {
> -               if (ops->enable == regulator_enable_regmap)
> -                       ret = ops->enable(rdev);
> -       } else {
> -               if (ops->disable == regulator_disable_regmap)
> -                       ret = rdev->desc->ops->disable(rdev);
> -       }
> +       if (enable)
> +               ret = ops->enable(rdev);
> +       else
> +               ret = ops->disable(rdev);

> Please let me know if anything wrong.

Sure.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-phy/attachments/20240614/7ebb4fd9/attachment-0001.sig>


More information about the linux-phy mailing list