From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] chipidea: Use devm_request_irq()
Date: Wed, 31 Jul 2013 11:44:34 +0200 [thread overview]
Message-ID: <20130731094434.GC1754@pengutronix.de> (raw)
In-Reply-To: <20130731090512.GD9858@sirena.org.uk>
[Expanded Cc: a bit]
Hello,
On Wed, Jul 31, 2013 at 10:05:12AM +0100, Mark Brown wrote:
> On Wed, Jul 31, 2013 at 10:46:45AM +0200, Uwe Kleine-K?nig wrote:
We're discussing about devm_request_irq and wonder what happens at
remove time when the irq is still active.
> > OK, so the possible problem is that remove is called while the irq is
> > still active. That means you have to assert that all resources the irq
> > handler is using (e.g. ioremap, clk_prepare_enable) are only freed
> > *after* the irq is done. For ioremap that means it must be done using
> > devm_ioremap_resource. For a clock it's not that easy because the irq
> > handler has to assert that a used clk is kept prepared which can only be
> > done using clk_prepare which in turn is not allowed in an irq handler.
>
> > Hmm. So the only possible fixes are
> > - devm* can be told to also care about clk_disable_unprepare
> > - after disabling irqs in the remove callback wait for all
> > active irqs to be done. (i.e. call synchronize_irq(irq))
> > - don't use devm_request_irq
>
> I'm not sure that devm_ guarantees any ordering in the cleanups it does
> so I'd not like to rely on the first option either, if there were some
> guarantee of that it'd help. The nice thing about explicitly freeing
> the IRQ is that you can tell that all this stuff is safe by inspection.
devm_* at least uses list_for_each_entry_reverse
(drivers/base/devres.c:release_nodes()). Without this guarantee devm_
would not make much sense IMHO.
To also manage clks, we'd need something like:
devm_clk_prepare(&dev, some_clk);
that makes devm_clk_release also call clk_unprepare the right number of
times. Maybe also the same for devm_clk_enable? Does this make sense?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next parent reply other threads:[~2013-07-31 9:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1375232669-27846-1-git-send-email-festevam@gmail.com>
[not found] ` <1375232669-27846-2-git-send-email-festevam@gmail.com>
[not found] ` <20130731073306.GZ1754@pengutronix.de>
[not found] ` <20130731082054.GF8540@nchen-desktop>
[not found] ` <20130731084645.GB1754@pengutronix.de>
[not found] ` <20130731090512.GD9858@sirena.org.uk>
2013-07-31 9:44 ` Uwe Kleine-König [this message]
2013-07-31 9:54 ` [PATCH 2/2] chipidea: Use devm_request_irq() Tejun Heo
2013-07-31 10:28 ` Uwe Kleine-König
2013-07-31 10:41 ` Tejun Heo
2013-07-31 11:18 ` Mark Brown
2013-07-31 11:32 ` Tejun Heo
2013-07-31 11:50 ` Mark Brown
2013-07-31 11:55 ` Tejun Heo
2013-07-31 13:27 ` Mark Brown
2013-07-31 13:42 ` Tejun Heo
2013-07-31 13:57 ` Mark Brown
2013-07-31 14:07 ` Tejun Heo
2013-07-31 15:25 ` Mark Brown
2013-07-31 15:29 ` Tejun Heo
2013-07-31 16:52 ` Mark Brown
2013-07-31 13:55 ` Peter Chen
2013-07-31 14:15 ` Tejun Heo
2013-08-01 1:33 ` Peter Chen
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=20130731094434.GC1754@pengutronix.de \
--to=u.kleine-koenig@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).