[PATCH 1/9] clocksource: time-armada-370-xp: Marvell Armada 370/XP SoC timer driver

Thomas Gleixner tglx at linutronix.de
Mon Jul 2 08:29:53 EDT 2012


On Mon, 2 Jul 2012, Thomas Petazzoni wrote:
> From: Gregory Clement <gregory.clement at free-electrons.com>
> +/*
> + * Clockevent handling.
> + */
> +static int
> +armada_370_xp_clkevt_next_event(unsigned long delta,
> +				struct clock_event_device *dev)
> +{
> +	unsigned long flags;
> +	u32 u;
> +
> +	if (delta == 0)
> +		return -ETIME;

If you have a proper min_delta_ns value set up, then delta will never
be 0. SO that check is pointless.

> +	local_irq_save(flags);

That code is guaranteed to be called with interrupts disabled. No need
for disabling them again.

> +
> +static void
> +armada_370_xp_clkevt_mode(enum clock_event_mode mode,
> +			  struct clock_event_device *dev)
> +{
> +	unsigned long flags;
> +	u32 u;
> +
> +	local_irq_save(flags);

Ditto.

> +	/*
> +	 * Setup clockevent timer (interrupt-driven).
> +	 */
> +	setup_irq(timer_irq, &armada_370_xp_timer_irq);
> +	armada_370_xp_clkevt.mult = div_sc(timer_clk, NSEC_PER_SEC,
> +					   armada_370_xp_clkevt.shift);
> +	armada_370_xp_clkevt.max_delta_ns = clockevent_delta2ns(0xfffffffe,
> +							&armada_370_xp_clkevt);
> +	armada_370_xp_clkevt.min_delta_ns =
> +	    clockevent_delta2ns(1, &armada_370_xp_clkevt);

clockevents_config_and_register() please.

Thanks,

	tglx



More information about the linux-arm-kernel mailing list