linux-snps-arc.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: p.zabel@pengutronix.de (Philipp Zabel)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH] ARC: HSDK: improve reset driver
Date: Fri, 14 Sep 2018 12:38:13 +0200	[thread overview]
Message-ID: <1536921493.4112.6.camel@pengutronix.de> (raw)
In-Reply-To: <20180827143803.28178-1-Eugeniy.Paltsev@synopsys.com>

Hi Eugeniy,

On Mon, 2018-08-27@17:38 +0300, Eugeniy Paltsev wrote:
> As for today HSDK reset driver implements only
> .reset() callback.
> 
> In case of driver which implements one of standard
> reset controller usage pattern
> (call *_deassert() in probe(), call *_assert() in remove())
> that leads to inoperability of this reset driver.
> 
> Improve HSDK reset driver by calling .reset() callback inside of
> .assert()/.deassert() callbacks to avoid each reset controller
> user adaptation for work with both reset methods
> (reset() and .assert()/.deassert() pair)
> 
> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev at synopsys.com>
> ---
>  drivers/reset/reset-hsdk.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/reset/reset-hsdk.c b/drivers/reset/reset-hsdk.c
> index 8bce391c6943..1fd91df91343 100644
> --- a/drivers/reset/reset-hsdk.c
> +++ b/drivers/reset/reset-hsdk.c
> @@ -86,6 +86,8 @@ static int hsdk_reset_reset(struct reset_controller_dev *rcdev,
>  
>  static const struct reset_control_ops hsdk_reset_ops = {
>  	.reset	= hsdk_reset_reset,
> +	.assert = hsdk_reset_reset,

This is incorrect for exclusive reset controls.
It will cause reset_control_assert() to return success for exclusive
reset controls, even though the .assert op failed to leave the reset
line asserted after the function returns.

While calling hsdk_reset_reset from .assert for shared reset controls
would be fine,?I don't see how this is necessary of useful.
If a consumer driver requires the reset to be asserted upon remove(), it
must not request a shared reset control anyway, because with shared
reset controls other drivers may keep the reset line deasserted
indefinitely.

> +	.deassert = hsdk_reset_reset,

This should be fine. I wonder from time to time whether this should be
implemented in the core, in reset_control_deassert().

regards
Philipp

  parent reply	other threads:[~2018-09-14 10:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-27 14:38 [PATCH] ARC: HSDK: improve reset driver Eugeniy Paltsev
2018-09-11 15:25 ` Eugeniy Paltsev
2018-09-14 10:38 ` Philipp Zabel [this message]
2018-09-24 11:08   ` Eugeniy Paltsev

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=1536921493.4112.6.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=linux-snps-arc@lists.infradead.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).