From: p.zabel@pengutronix.de (Philipp Zabel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/7] reset: lpc18xx: use devm_reset_controller_register()
Date: Tue, 03 May 2016 13:08:10 +0200 [thread overview]
Message-ID: <1462273690.3617.56.camel@pengutronix.de> (raw)
In-Reply-To: <CAK7LNAQga-dCmAWevKMQx2DBzGim8DmNyeCxj4n5q-SjEapd+Q@mail.gmail.com>
Am Dienstag, den 03.05.2016, 19:25 +0900 schrieb Masahiro Yamada:
> Hi Philipp,
>
> 2016-05-03 18:05 GMT+09:00 Philipp Zabel <p.zabel@pengutronix.de>:
> > Am Dienstag, den 03.05.2016, 00:52 +0900 schrieb Masahiro Yamada:
> >> 2016-05-02 17:26 GMT+09:00 Philipp Zabel <p.zabel@pengutronix.de>:
> >> > Am Sonntag, den 01.05.2016, 19:36 +0900 schrieb Masahiro Yamada:
> >> >> Use devm_reset_controller_register() for the reset controller
> >> >> registration and remove the unregister call from the .remove callback.
> >> >>
> >> >> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> >> >> ---
> >> >>
> >> >> drivers/reset/reset-lpc18xx.c | 4 +---
> >> >> 1 file changed, 1 insertion(+), 3 deletions(-)
> >> >>
> >> >> diff --git a/drivers/reset/reset-lpc18xx.c b/drivers/reset/reset-lpc18xx.c
> >> >> index 3b8a4f5..dd4f27e 100644
> >> >> --- a/drivers/reset/reset-lpc18xx.c
> >> >> +++ b/drivers/reset/reset-lpc18xx.c
> >> >> @@ -199,7 +199,7 @@ static int lpc18xx_rgu_probe(struct platform_device *pdev)
> >> >>
> >> >> platform_set_drvdata(pdev, rc);
> >> >>
> >> >> - ret = reset_controller_register(&rc->rcdev);
> >> >> + ret = devm_reset_controller_register(&pdev->dev, &rc->rcdev);
> >> >> if (ret) {
> >> >> dev_err(&pdev->dev, "unable to register device\n");
> >> >> goto dis_clks;
> >> >> @@ -229,8 +229,6 @@ static int lpc18xx_rgu_remove(struct platform_device *pdev)
> >> >> if (ret)
> >> >> dev_warn(&pdev->dev, "failed to unregister restart handler\n");
> >> >>
> >> >> - reset_controller_unregister(&rc->rcdev);
> >> >> -
> >> >> clk_disable_unprepare(rc->clk_delay);
> >> >> clk_disable_unprepare(rc->clk_reg);
> >> >>
> >> >
> >> > Hmm, would this patch theoretically allow a window between the calls to
> >> > clk_disable_unprepare(clk_reg) and devm_reset_controller_release() where
> >> > reset_control_get() + reset_control_(de)assert() would access unclocked
> >> > registers?
> >>
> >> This is not clear to me.
> >>
> >> Why reset_control_get() + reset_control_(de)assert() would happen here?
> >
> > I suppose on a non-SMP device, without parallel probing this can't
> > really happen in practice.
> > It still seems weird that suddenly we disable the clocks before
> > unregistering the reset controller instead of afterwards.
> >
>
> I still do not understand what you mean.
>
> This patch moves the reset_controller_unregister() call
> after clk_disable_unprepare().
And so the register access is made impossible before the reset
controller device actually vanishes from the publicly visible list.
> But, reset_controller_unregister() is just a manipulation of a liked list.
> It does not trigger any hardware access.
>
> Am I wrong?
No, you are perfectly right. I don't see how this can be a real problem
unless at the same time another driver could try to request the still
available reset control.
regards
Philipp
next prev parent reply other threads:[~2016-05-03 11:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-01 10:36 [PATCH 0/7] reset: add managned reset_controller_register() Masahiro Yamada
2016-05-01 10:36 ` [PATCH 1/7] reset: add devm_reset_controller_register API Masahiro Yamada
2016-05-03 10:07 ` Laxman Dewangan
2016-05-03 10:17 ` Philipp Zabel
2016-05-03 10:26 ` Masahiro Yamada
2016-05-03 11:41 ` Masahiro Yamada
2016-05-03 14:20 ` Philipp Zabel
2016-05-01 10:36 ` [PATCH 2/7] reset: ath79: use devm_reset_controller_register() Masahiro Yamada
2016-05-01 10:36 ` [PATCH 3/7] reset: lpc18xx: " Masahiro Yamada
2016-05-01 21:04 ` Joachim Eastwood
2016-05-02 8:26 ` Philipp Zabel
2016-05-02 15:52 ` Masahiro Yamada
2016-05-03 9:05 ` Philipp Zabel
2016-05-03 10:25 ` Masahiro Yamada
2016-05-03 11:08 ` Philipp Zabel [this message]
2016-05-03 11:40 ` Masahiro Yamada
2016-05-01 10:37 ` [PATCH 4/7] reset: pistachio: " Masahiro Yamada
2016-05-01 10:37 ` [PATCH 5/7] reset: sunxi: " Masahiro Yamada
2016-05-01 10:37 ` [PATCH 6/7] reset: socfpga: " Masahiro Yamada
2016-05-01 10:37 ` [PATCH 7/7] reset: zynq: " Masahiro Yamada
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=1462273690.3617.56.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=linux-arm-kernel@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).