devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Wadim Egorov <w.egorov@phytec.de>
Cc: linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
	devicetree@vger.kernel.org, robh+dt@kernel.org,
	pawel.moll@arm.com, mark.rutland@arm.com,
	ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
	lee.jones@linaro.org, lgirdwood@gmail.com, dianders@chromium.org,
	zyw@rock-chips.com
Subject: Re: [RFC 2/3] regulator: rk808: Add support for rk818
Date: Sun, 10 Apr 2016 20:04:41 +0100	[thread overview]
Message-ID: <20160410190441.GC18319@sirena.org.uk> (raw)
In-Reply-To: <1460108861-32818-3-git-send-email-w.egorov@phytec.de>

[-- Attachment #1: Type: text/plain, Size: 998 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2016-04-10 19:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08  9:47 [RFC 0/3] Add RK818 PMIC support Wadim Egorov
     [not found] ` <1460108861-32818-1-git-send-email-w.egorov-guT5V/WYfQezQB+pC5nmwQ@public.gmane.org>
2016-04-08  9:47   ` [RFC 1/3] mfd: RK808: Add RK818 support Wadim Egorov
2016-04-11  8:41     ` Lee Jones
2016-04-08  9:47   ` [RFC 2/3] regulator: rk808: Add support for rk818 Wadim Egorov
2016-04-10 19:04     ` Mark Brown [this message]
2016-04-08  9:47   ` [RFC 3/3] mfd: dt-bindings: Add RK818 device tree bindings document Wadim Egorov
     [not found]     ` <1460108861-32818-4-git-send-email-w.egorov-guT5V/WYfQezQB+pC5nmwQ@public.gmane.org>
2016-04-11  8:44       ` Lee Jones
2016-04-11 16:03         ` Rob Herring
2016-04-11 16:19           ` Lee Jones
2016-04-11 15:48       ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160410190441.GC18319@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=w.egorov@phytec.de \
    --cc=zyw@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).