public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
To: Mark Brown <broonie@kernel.org>
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: Tue, 25 Aug 2020 02:23:10 +0300	[thread overview]
Message-ID: <20200824232310.GA2301286@BV030612LT> (raw)
In-Reply-To: <20200824110045.GA4676@sirena.org.uk>

Hi Mark,

Thanks for reviewing!

On Mon, Aug 24, 2020 at 12:00:45PM +0100, Mark Brown wrote:
> 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.

Sure, I can provide separate ops, but in this case we duplicate almost
all of them. If this is not acceptable, then I will just rewrite the
conditional statement.

> > +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.

I have actually seen this in some MFD drivers I had been studying before
starting this work. I wasn't sure what is the rationale behind, I
assumed they have just an informative purpose.

So, if I understand correctly, this approach is deprecated now and I
should remove the compatibles from both the function driver and the
corresponding mfd_cell in the core implementation. And not only for
regulators, but for all the other functions of the MFD device.

Regards,
Cristi

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

Thread overview: 26+ 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-22  3:47   ` kernel test robot
2020-09-29  9:48     ` Lee Jones
2020-09-29 20:45       ` Cristian Ciocaltea
2020-08-21 22:19 ` [PATCH v2 3/6] regulator: Add regulator " Cristian Ciocaltea
2020-08-24 11:00   ` Mark Brown
2020-08-24 23:23     ` Cristian Ciocaltea [this message]
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=20200824232310.GA2301286@BV030612LT \
    --to=cristian.ciocaltea@gmail.com \
    --cc=afaerber@suse.de \
    --cc=broonie@kernel.org \
    --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