Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1187413

Re: [PATCH 3/3] clocksource: atmel-pit: Remove irq handler when clock event is unused

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] clocksource: atmel-pit: Remove irq handler when clock event is unused
Date 2015-07-18 10:30 +0200
Message-ID <pNvFo-76g-5@gated-at.bofh.it> (permalink)
References <pNjEd-6vh-11@gated-at.bofh.it> <pNjEd-6vh-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH 3/3] clocksource: atmel-pit: Remove irq handler when  clock event is unused Thomas Gleixner <tglx@linutronix.de> - 2015-07-18 10:30 +0200

csiph-web