public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Wenyou Yang <wenyou.yang@atmel.com>
Cc: lgirdwood@gmail.com, linux-kernel@vger.kernel.org,
	grant.likely@linaro.org, rob.herring@calxeda.com,
	linux-doc@vger.kernel.org, vpalatin@chromium.org,
	nicolas.ferre@atmel.com, plagnioj@jcrosoft.com,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 1/3 v2] regulator: act8865: add PMIC act8865 driver
Date: Tue, 17 Dec 2013 13:06:53 +0000	[thread overview]
Message-ID: <20131217130653.GA3185@sirena.org.uk> (raw)
In-Reply-To: <1387258597-21866-2-git-send-email-wenyou.yang@atmel.com>

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

On Tue, Dec 17, 2013 at 01:36:35PM +0800, Wenyou Yang wrote:
>  Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>

Much better.  Still a few small issues though.

> +/* ACt8865 voltage table */
> +static const u32 act8865_voltages_table[] = {

This is the wrong type for a voltage table but it looks like it
shouldn't be a voltage table at all - this looks like it should be
mapped as linear ranges.

> +static struct regulator_ops act8865_ops = {
> +	.list_voltage		= regulator_list_voltage_table,
> +	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
> +	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
> +	.enable			= regulator_enable_regmap,
> +	.disable		= regulator_disable_regmap,
> +	.is_enabled		= regulator_is_enabled_regmap,
> +	.set_suspend_voltage	= act8865_set_suspend_voltage,
> +	.set_suspend_enable	= regulator_enable_regmap,
> +	.set_suspend_disable	= regulator_disable_regmap,
> +};

This is missing a map_voltage() operation.

> +#ifdef CONFIG_OF
> +static const struct of_device_id act8865_dt_ids[] = {
> +	{ .compatible = "active-semi,act8865" },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, act8865_dt_ids);

active-semi needs adding to vendor-prefixes.txt.

> +	np = of_find_node_by_name(dev->of_node, "regulators");
> +	if (!np) {
> +		dev_err(dev, "missing 'regulators' subnode in DT\n");
> +		return -EINVAL;
> +	}
> +
> +	for (i = 0; i < ARRAY_SIZE(rmatch); i++)
> +		rmatch[i].name = act8865_reg[i].name;
> +
> +	matched = of_regulator_match(dev, np, rmatch, ARRAY_SIZE(rmatch));
> +	if (matched <= 0)
> +		return matched;

You should register all regulators the device has regardless of how many
have parameters configured in the DT so that the settings can be read
back for diagnostic purposes.

> +	if (dev->of_node && !pdata) {
> +		const struct of_device_id *id;
> +		struct act8865_platform_data pdata_of;
> +
> +		id = of_match_device(of_match_ptr(act8865_dt_ids), dev);
> +		if (!id)
> +			return -ENODEV;
> +
> +		ret = act8865_pdata_from_dt(dev, of_node, &pdata_of);
> +		if (ret < 0)
> +			return ret;
> +
> +		pdata = &pdata_of;
> +	} else {
> +		memset(of_node, 0, sizeof(of_node));
> +	}

What's this memset() for?

> +		rdev[i] = devm_regulator_register(&client->dev,
> +						&act8865_reg[i], &config);

> +err_unregister:
> +	while (--i >= 0)
> +		regulator_unregister(rdev[i]);

The whole purpose of devm_ APIs is to avoid the need to explicitly
unregister, you shouldn't need to call regulator_unregister() at all.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-12-17 13:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17  5:36 [PATCH 0/3 v2] regulator: act8865: add PMIC driver Wenyou Yang
2013-12-17  5:36 ` [PATCH 1/3 v2] regulator: act8865: add PMIC act8865 driver Wenyou Yang
2013-12-17 13:06   ` Mark Brown [this message]
2013-12-18  3:11     ` Yang, Wenyou
2013-12-18 11:06       ` Mark Brown
2013-12-17  5:36 ` [PATCH 2/3 v2] regulator: act8865: add device tree binding doc Wenyou Yang
2013-12-17 12:47   ` Mark Brown
2013-12-18  3:12     ` Yang, Wenyou
2013-12-17  5:36 ` [PATCH 3/3 v2] ARM: dts: sama5d3xcm: add the regulator device node Wenyou Yang
2013-12-17 12:38   ` Mark Brown
2013-12-18  3:15     ` Yang, Wenyou

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=20131217130653.GA3185@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=plagnioj@jcrosoft.com \
    --cc=rob.herring@calxeda.com \
    --cc=vpalatin@chromium.org \
    --cc=wenyou.yang@atmel.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