Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: tglx@linutronix.de (Thomas Gleixner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] clocksource: atmel-pit: Remove irq handler when clock event is unused
Date: Sat, 18 Jul 2015 10:20:53 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.11.1507181013050.18576@nanos> (raw)
In-Reply-To: <1437161608-26782-4-git-send-email-alexandre.belloni@free-electrons.com>

On Fri, 17 Jul 2015, Alexandre Belloni wrote:
>  /*
> + * IRQ handler for the timer.
> + */
> +static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id)
> +{
> +	struct pit_data *data = dev_id;
> +
> +	/*
> +	 * irqs should be disabled here, but as the irq is shared they are only
> +	 * guaranteed to be off if the timer irq is registered first.

That's wrong. We run all handlers with interrupts disabled for about 5
years now.

> +	 */
> +	WARN_ON_ONCE(!irqs_disabled());


> +	/* The PIT interrupt may be disabled, and is shared */
> +	if (clockevent_state_periodic(&data->clkevt) &&
> +	    (pit_read(data->base, AT91_PIT_SR) & AT91_PIT_PITS)) {
> +		unsigned nr_ticks;
> +
> +		/* Get number of ticks performed before irq, and ack it */
> +		nr_ticks = PIT_PICNT(pit_read(data->base, AT91_PIT_PIVR));
> +		do {
> +			data->cnt += data->cycle;
> +			data->clkevt.event_handler(&data->clkevt);
> +			nr_ticks--;
> +		} while (nr_ticks);

I don't think you need this loop. You have a proper clocksource
registered so the timekeeping code will handle the lost ticks nicely.


Thanks,

	tglx

  reply	other threads:[~2015-07-18  8:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-17 19:33 [PATCH 0/3] clocksource: at91: Remove irq handler when clock event is unused Alexandre Belloni
2015-07-17 19:33 ` [PATCH 1/3] clocksource: atmel-st: " Alexandre Belloni
2015-07-18  8:12   ` Thomas Gleixner
2015-07-18 22:23     ` Alexandre Belloni
2015-07-20  9:04       ` Thomas Gleixner
2015-07-20 19:37         ` Alexandre Belloni
2015-07-20 20:46           ` Thomas Gleixner
2015-08-02  9:10             ` Thomas Gleixner
2015-08-02  9:40               ` Peter Zijlstra
2015-08-03 13:30                 ` Boris Brezillon
2015-08-03 14:36                   ` Thomas Gleixner
2015-08-03 20:07                     ` Boris Brezillon
2015-07-17 19:33 ` [PATCH 2/3] clocksource: atmel-pit: drop at91sam926x_pit_common_init Alexandre Belloni
2015-07-17 19:33 ` [PATCH 3/3] clocksource: atmel-pit: Remove irq handler when clock event is unused Alexandre Belloni
2015-07-18  8:20   ` Thomas Gleixner [this message]
2015-07-18 22:18     ` 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=alpine.DEB.2.11.1507181013050.18576@nanos \
    --to=tglx@linutronix.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