mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Alexandru Gagniuc <alex.g@adaptrum.com>, linux-kernel@vger.kernel.org
Cc: Andre Przywara <andre.przywara@arm.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	Chen-Yu Tsai <wens@csie.org>, Baoyou Xie <baoyou.xie@linaro.org>,
	Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>,
	Steffen Trumtrar <s.trumtrar@pengutronix.de>,
	Dinh Nguyen <dinguyen@kernel.org>,
	linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de
Subject: Re: [PATCH v2 2/5] reset: socfpga: use the reset-simple driver
Date: Fri, 11 Aug 2017 18:50:41 +0200	[thread overview]
Message-ID: <1502470241.2310.29.camel@pengutronix.de> (raw)
In-Reply-To: <d1d06519-f676-5d36-2f82-e9537cef4f74@adaptrum.com>

Hi Alexandru,

thank you for the comments.

On Fri, 2017-08-11 at 09:28 -0700, Alexandru Gagniuc wrote:
> Hi Phillip,
> 
> On 08/11/2017 06:06 AM, Philipp Zabel wrote:
> [snip]
> 
> > @@ -113,8 +137,33 @@ static int reset_simple_probe(struct platform_device *pdev)
> > > >  	data->rcdev.ops = &reset_simple_ops;
> > > >  	data->rcdev.of_node = dev->of_node;
> > 
> > > > -	if (devdata)
> > +	if (devdata == &reset_simple_socfpga) {
> 
> This sort of special-case handling opens the gate to adding special-case 
> handling for any new device, which somewhat defeats the purpose of a 
> generic driver.

That is why I initially only unified the reset ops and not the whole
platorm driver.

I could partially revert this latest change and keep the reset-socfpga
driver, just reusing the reset-simple ops to avoid potential "quirk
creep" in the reset-simple driver.

Or I could drop the #reset-cells warning below and just read the
altr,modrst-offset property for any reset controller, to avoid the
special-case.

> > +		u32 modrst_offset;
> > +
> > > > +		/*
> > > > +		 * The binding was mainlined without the required property.
> > > > +		 * Do not continue, when we encounter an old DT.
> > > > +		 */
> > > > +		if (!of_find_property(dev->of_node, "#reset-cells", NULL)) {
> > > > +			dev_err(dev, "%pOF missing #reset-cells property\n",
> > > > +				dev->of_node);
> > > > +			return -EINVAL;
> > > > +		}
> 
> Is the check still required in this context, since 
> (devm_)reset_control_get() complains really loudly if #reset-cells is 
> missing?

I'm fine with removing this. Ideally, this is something that the device
tree compiler should check already.

> > +
> > > > +		if (of_property_read_u32(dev->of_node, "altr,modrst-offset",
> > > > +					 &modrst_offset)) {
> > > > +			dev_warn(dev, "missing altr,modrst-offset property, assuming 0x10!\n");
> > > > +			modrst_offset = 0x10;
> > +		}
> 
> This can be a generic "reg-offset" property. If and until the 
> devicetrees are updated, "altr,modrst-offset" would also have to be read 
> as an alternative.

Possibly. Adding new device tree bindings is a separate discussion.

> Since a platform data already exists, reset_simple_devdata could be a
> better place to store the default offset of 0x10 for socfpga.

I'll change this as you suggest.

regards
Philipp

  reply	other threads:[~2017-08-11 16:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-11 13:06 [PATCH v2 0/5] Unify simple reset drivers Philipp Zabel
2017-08-11 13:06 ` [PATCH v2 1/5] reset: add reset-simple to unify socfpga, stm32, sunxi, and zx2967 Philipp Zabel
2017-08-11 15:39   ` Dinh Nguyen
2017-08-11 15:59     ` Philipp Zabel
2017-08-11 15:51   ` Chen-Yu Tsai
2017-08-11 15:57     ` Philipp Zabel
2017-08-11 16:04   ` Alexandru Gagniuc
2017-08-11 16:37     ` Philipp Zabel
2017-08-14 13:45       ` Eugeniy Paltsev
2017-08-11 17:47   ` Alexandru Gagniuc
2017-08-14  7:26     ` Philipp Zabel
2017-08-11 13:06 ` [PATCH v2 2/5] reset: socfpga: use the reset-simple driver Philipp Zabel
2017-08-11 16:28   ` Alexandru Gagniuc
2017-08-11 16:50     ` Philipp Zabel [this message]
2017-08-11 13:06 ` [PATCH v2 3/5] reset: stm32: " Philipp Zabel
2017-08-11 13:06 ` [PATCH v2 4/5] reset: zx2967: " Philipp Zabel
2017-08-11 13:06 ` [PATCH v2 5/5] reset: simple: read back to make sure changes are applied Philipp Zabel

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=1502470241.2310.29.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=Eugeniy.Paltsev@synopsys.com \
    --cc=alex.g@adaptrum.com \
    --cc=alexandre.torgue@st.com \
    --cc=andre.przywara@arm.com \
    --cc=baoyou.xie@linaro.org \
    --cc=dinguyen@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=s.trumtrar@pengutronix.de \
    --cc=wens@csie.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

Powered by JetHome