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:	Sun, 10 Apr 2016 20:04:41 +0100
From:	Mark Brown <broonie@...nel.org>
To:	Wadim Egorov <w.egorov@...tec.de>
Cc:	linux-kernel@...r.kernel.org, linux-rockchip@...ts.infradead.org,
	devicetree@...r.kernel.org, robh+dt@...nel.org, pawel.moll@....com,
	mark.rutland@....com, ijc+devicetree@...lion.org.uk,
	galak@...eaurora.org, lee.jones@...aro.org, lgirdwood@...il.com,
	dianders@...omium.org, zyw@...k-chips.com
Subject: Re: [RFC 2/3] regulator: rk808: Add support for rk818

On Fri, Apr 08, 2016 at 11:47:40AM +0200, Wadim Egorov wrote:

> +static const struct regulator_linear_range rk818_buck4_voltage_ranges[] = {
> +	REGULATOR_LINEAR_RANGE(1800000, 0, 18, 100000),
> +};
> +
> +static const struct regulator_linear_range rk818_boost_voltage_ranges[] = {
> +	REGULATOR_LINEAR_RANGE(4700000, 0, 7, 100000),
> +};

Why are these done as linear ranges when there's only one range?  This
just adds overhead, just specify the one range directly in the desc and
use the appropriate ops.

> +	if (rk808->variant == RK808_ID)
> +		ret = of_regulator_match(dev, np, rk808_reg_matches,
> +					 RK808_NUM_REGULATORS);
> +	else if (rk808->variant == RK818_ID)
> +		ret = of_regulator_match(dev, np, rk818_reg_matches,
> +					RK818_NUM_REGULATORS);

Don't use of_regulator_match, just specify the DT names for the
regulator in the desc.  Also it looks like you're trying to write a
switch statement with ifs here, just write a switch statement.  It's
clearer and less error prone.

Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)

Powered by blists - more mailing lists