linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
Cc: "Lee Jones" <lee.jones@linaro.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Andreas Färber" <afaerber@suse.de>,
	linux-actions@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH v2 3/6] regulator: Add regulator driver for ATC260x PMICs
Date: Mon, 24 Aug 2020 12:00:45 +0100	[thread overview]
Message-ID: <20200824110045.GA4676@sirena.org.uk> (raw)
In-Reply-To: <8da70f0b19de17fb8edead7ff06461ae2451b0e9.1598043782.git.cristian.ciocaltea@gmail.com>

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

On Sat, Aug 22, 2020 at 01:19:49AM +0300, Cristian Ciocaltea wrote:

> +static int atc260x_set_voltage_time_sel(struct regulator_dev *rdev,
> +					unsigned int old_selector,
> +					unsigned int new_selector)
> +{
> +	struct atc260x_regulator_data *data = rdev_get_drvdata(rdev);
> +	int id = rdev_get_id(rdev);
> +
> +	if (new_selector > old_selector)
> +		return id > data->last_dcdc_reg_id ? data->voltage_time_ldo
> +						   : data->voltage_time_dcdc;

Please write normal conditional statements to make things easier to
read.  It also looks like this would be more robustly written by just
having separate ops for DCDCs and LDOs, this could easily break if
another device is supported in the driver.

> +static const struct of_device_id atc260x_regulator_of_match[] = {
> +	{ .compatible = "actions,atc2603c-regulator" },
> +	{ .compatible = "actions,atc2609a-regulator" },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, atc260x_regulator_of_match);

We don't need compatibles here, this is just reflecting the current
Linux device model into the OS neutral DT bindings.  Another OS may
choose to split regulators up differently.  We should just instantiate
the regulator device from the MFD based on identifying the chip overall.

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

  reply	other threads:[~2020-08-24 11:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21 22:19 [PATCH v2 0/6] Add initial support for ATC260x PMICs Cristian Ciocaltea
2020-08-21 22:19 ` [PATCH v2 1/6] dt-bindings: mfd: Add Actions Semi ATC260x PMIC binding Cristian Ciocaltea
2020-09-08 21:47   ` Rob Herring
2020-09-09 16:03     ` Cristian Ciocaltea
2020-09-09 17:22       ` Rob Herring
2020-08-21 22:19 ` [PATCH v2 2/6] mfd: Add MFD driver for ATC260x PMICs Cristian Ciocaltea
2020-08-21 22:19 ` [PATCH v2 3/6] regulator: Add regulator " Cristian Ciocaltea
2020-08-24 11:00   ` Mark Brown [this message]
2020-08-24 23:23     ` Cristian Ciocaltea
2020-08-25 10:55       ` Mark Brown
2020-08-21 22:19 ` [PATCH v2 4/6] power: reset: Add poweroff " Cristian Ciocaltea
2020-08-24 14:41   ` Sebastian Reichel
2020-08-24 23:31     ` Cristian Ciocaltea
2020-08-21 22:19 ` [PATCH v2 5/6] input: atc260x: Add onkey " Cristian Ciocaltea
2020-09-14 21:09   ` Dmitry Torokhov
2020-09-18 10:35     ` Cristian Ciocaltea
2020-09-29 20:35       ` Dmitry Torokhov
2020-09-29 21:46         ` Cristian Ciocaltea
2020-08-21 22:19 ` [PATCH v2 6/6] MAINTAINERS: Add entry for ATC260x PMIC Cristian Ciocaltea
2020-08-21 22:26 ` [PATCH v2 0/6] Add initial support for ATC260x PMICs Cristian Ciocaltea
2020-08-22 13:13   ` Manivannan Sadhasivam
2020-08-22 23:24     ` Cristian Ciocaltea
2020-08-25  3:48       ` Manivannan Sadhasivam

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=20200824110045.GA4676@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=afaerber@suse.de \
    --cc=cristian.ciocaltea@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-actions@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.org \
    /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).