lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 20 Jun 2024 16:52:11 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Prabhakar <prabhakar.csengg@...il.com>
Cc: Ulf Hansson <ulf.hansson@...aro.org>, Rob Herring <robh@...nel.org>, 
	Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, 
	Wolfram Sang <wsa+renesas@...g-engineering.com>, Liam Girdwood <lgirdwood@...il.com>, 
	Mark Brown <broonie@...nel.org>, Magnus Damm <magnus.damm@...il.com>, linux-mmc@...r.kernel.org, 
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-renesas-soc@...r.kernel.org, 
	Fabrizio Castro <fabrizio.castro.jz@...esas.com>, Biju Das <biju.das.jz@...renesas.com>, 
	Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
Subject: Re: [RFC PATCH 2/4] regulator: core: Add regulator_map_voltage_descend()
 API

Hi Prabhakar,

On Wed, Jun 5, 2024 at 9:49 AM Prabhakar <prabhakar.csengg@...il.com> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
>
> Similarly to regulator_map_voltage_ascend() api add
> regulator_map_voltage_descend() api and export it.
>
> Drivers that have descendant voltage list can use this as their
> map_voltage() operation.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>

Thanks for your patch!

> --- a/drivers/regulator/helpers.c
> +++ b/drivers/regulator/helpers.c
> @@ -368,6 +368,37 @@ int regulator_map_voltage_ascend(struct regulator_dev *rdev,
>  }
>  EXPORT_SYMBOL_GPL(regulator_map_voltage_ascend);
>
> +/**
> + * regulator_map_voltage_descend - map_voltage() for descendant voltage list
> + *
> + * @rdev: Regulator to operate on
> + * @min_uV: Lower bound for voltage
> + * @max_uV: Upper bound for voltage
> + *
> + * Drivers that have descendant voltage list can use this as their
> + * map_voltage() operation.
> + */
> +int regulator_map_voltage_descend(struct regulator_dev *rdev,
> +                                 int min_uV, int max_uV)
> +{
> +       int i, ret;
> +
> +       for (i = rdev->desc->n_voltages - 1; i >= 0 ; i--) {
> +               ret = rdev->desc->ops->list_voltage(rdev, i);
> +               if (ret < 0)
> +                       continue;
> +
> +               if (ret > min_uV)

I know this patch is superseded, but shouldn't this be "<"?

> +                       break;
> +
> +               if (ret >= min_uV && ret <= max_uV)
> +                       return i;
> +       }
> +
> +       return -EINVAL;
> +}
> +EXPORT_SYMBOL_GPL(regulator_map_voltage_descend);
> +
>  /**
>   * regulator_map_voltage_linear - map_voltage() for simple linear mappings
>   *

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ