mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: James Ban <James.Ban.opensource@diasemi.com>
Cc: LINUXKERNEL <linux-kernel@vger.kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	David Dajun Chen <david.chen@diasemi.com>,
	Support Opensource <support.opensource@diasemi.com>
Subject: Re: [PATCH V1] regulator: pv88060: new regulator driver
Date: Tue, 17 Nov 2015 18:50:30 +0000	[thread overview]
Message-ID: <20151117185030.GD31303@sirena.org.uk> (raw)
In-Reply-To: <201511170518.tAH5Ic1j043774@krsrvapps-01.diasemi.com>

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

On Tue, Nov 17, 2015 at 11:25:21AM +0900, James Ban wrote:

A couple of minor points but overall this looks good:

> +	node = of_get_child_by_name(dev->of_node, "regulators");
> +	if (!node) {
> +		dev_err(dev, "regulators node not found\n");
> +		return ERR_PTR(-ENODEV);
> +	}
> +
> +	num = of_regulator_match(dev, node, pv88060_matches,
> +				 ARRAY_SIZE(pv88060_matches));

Don't manually parse the DT, use the core support and set of_match and
regulators_node in the regulator_desc.

> +		if (i == 0) {
> +			pv88060_matches[i].init_data->constraints
> +				.valid_modes_mask
> +				|= REGULATOR_MODE_FAST
> +				| REGULATOR_MODE_NORMAL
> +				| REGULATOR_MODE_STANDBY;
> +			pv88060_matches[i].init_data->constraints.valid_ops_mask
> +				|=	REGULATOR_CHANGE_MODE;
> +		}

The driver should never modify the constraints that are passed in - the
whole point with constraints is to allow the system to set up what is
safe on that particular system.

> +	if (!chip->pdata)
> +		chip->pdata = pv88060_parse_regulators_dt(chip->dev);
> +
> +	if (IS_ERR(chip->pdata)) {
> +		dev_err(chip->dev, "No regulators defined for the platform\n");
> +		return PTR_ERR(chip->pdata);
> +	}

This should not be an error, the driver should just instantiate all
regulators the device has and at least let people read back the current
state.

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

      reply	other threads:[~2015-11-17 18:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17  2:25 James Ban
2015-11-17 18:50 ` Mark Brown [this message]

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=20151117185030.GD31303@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=James.Ban.opensource@diasemi.com \
    --cc=david.chen@diasemi.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=support.opensource@diasemi.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

all inboxes | Powered by JetHome®