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]
Message-id: <50C99839.1040803@samsung.com>
Date:	Thu, 13 Dec 2012 09:56:25 +0100
From:	Marek Szyprowski <m.szyprowski@...sung.com>
To:	Axel Lin <axel.lin@...ics.com>
Cc:	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Pawel Moll <pawel.moll@....com>, Liam Girdwood <lrg@...com>,
	linux-kernel@...r.kernel.org, Chris Ball <cjb@...top.org>,
	Kevin Liu <keyuan.liu@...il.com>
Subject: Re: [PATCH RFC/RFT] regulator: core: Fix continuous_voltage_range case
 in regulator_can_change_voltage

Hello,

On 12/12/2012 2:22 AM, Axel Lin wrote:
> Regulator drivers with continuous_voltage_range flag set allows not setting
> n_voltages. Thus if continuous_voltage_range is set, check the constraint range
> instead.
>
> Signed-off-by: Axel Lin <axel.lin@...ics.com>
> ---
>   drivers/regulator/core.c |   12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 0f65b24..d7448ad 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -1885,9 +1885,15 @@ int regulator_can_change_voltage(struct regulator *regulator)
>   	struct regulator_dev	*rdev = regulator->rdev;
>
>   	if (rdev->constraints &&
> -	    rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE &&
> -	    (rdev->desc->n_voltages - rdev->desc->linear_min_sel) > 1)
> -		return 1;
> +	    (rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
> +		if (rdev->desc->n_voltages - rdev->desc->linear_min_sel > 1)
> +			return 1;
> +
> +		if (rdev->desc->continuous_voltage_range &&
> +		    rdev->constraints->min_uV && rdev->constraints->max_uV &&
> +		    rdev->constraints->min_uV != rdev->constraints->max_uV)
> +			return 1;
> +	}
>
>   	return 0;
>   }
>

This change looks reasonable, I've missed the fact that there is a
support for regulators with continuous voltage range. This change also
shows that the n_voltages based workaround used earlier by mmc core was
indeed only a hack and regulator_can_change_voltage() approach is much
cleaner solution.

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ