From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>,
<bigeasy@linutronix.de>, Thomas Gleixner <tglx@linutronix.de>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <linux-rt-users@vger.kernel.org>
Subject: Re: [PATCH] clockevents/drivers/timer-atmel-pit: fix double free_irq
Date: Fri, 18 Mar 2016 09:20:03 +0100 [thread overview]
Message-ID: <56EBBA33.9080809@atmel.com> (raw)
In-Reply-To: <1458245383-9859-1-git-send-email-alexandre.belloni@free-electrons.com>
Le 17/03/2016 21:09, Alexandre Belloni a écrit :
> clockevents_exchange_device() changes the state from detached to shutdown
> and so at that point the IRQ has not yet been requested.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
>
> Hi Sebastian,
>
> This patch fixes the last warning for preempt-rt on at91. It applies on
> v4.4.4-rt11. Note that the whome PIT/TCB mess will be fixed in another way in
> the mainline as we are reworking the tcb driver to avoid using the pit when
> booting.
Yes, it's the plan!
Thanks Alexandre. Bye.
>
> drivers/clocksource/timer-atmel-pit.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
> index a7abdb6638cd..7a40f7e88468 100644
> --- a/drivers/clocksource/timer-atmel-pit.c
> +++ b/drivers/clocksource/timer-atmel-pit.c
> @@ -46,6 +46,7 @@ struct pit_data {
> u32 cycle;
> u32 cnt;
> unsigned int irq;
> + bool irq_requested;
> struct clk *mck;
> };
>
> @@ -96,7 +97,10 @@ static int pit_clkevt_shutdown(struct clock_event_device *dev)
>
> /* disable irq, leaving the clocksource active */
> pit_write(data->base, AT91_PIT_MR, (data->cycle - 1) | AT91_PIT_PITEN);
> - free_irq(data->irq, data);
> + if (data->irq_requested) {
> + free_irq(data->irq, data);
> + data->irq_requested = false;
> + }
> return 0;
> }
>
> @@ -115,6 +119,8 @@ static int pit_clkevt_set_periodic(struct clock_event_device *dev)
> if (ret)
> panic(pr_fmt("Unable to setup IRQ\n"));
>
> + data->irq_requested = true;
> +
> /* update clocksource counter */
> data->cnt += data->cycle * PIT_PICNT(pit_read(data->base, AT91_PIT_PIVR));
> pit_write(data->base, AT91_PIT_MR,
>
--
Nicolas Ferre
next prev parent reply other threads:[~2016-03-18 8:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-17 20:09 [PATCH] clockevents/drivers/timer-atmel-pit: fix double free_irq Alexandre Belloni
2016-03-18 8:20 ` Nicolas Ferre [this message]
2016-03-29 13:32 ` Sebastian Andrzej Siewior
2016-03-29 13:34 ` Nicolas Ferre
2016-03-29 13:52 ` Alexandre Belloni
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=56EBBA33.9080809@atmel.com \
--to=nicolas.ferre@atmel.com \
--cc=alexandre.belloni@free-electrons.com \
--cc=bigeasy@linutronix.de \
--cc=boris.brezillon@free-electrons.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=tglx@linutronix.de \
/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