Commit 795b56cf authored by Philippe Gerum's avatar Philippe Gerum

ipipe: tick: cap timer_set op to device supported max

At this chance, switch the min_delay_tick value to unsigned long to
match the corresponding clockevent definition.
parent 113f8748
...@@ -64,7 +64,8 @@ struct ipipe_timer { ...@@ -64,7 +64,8 @@ struct ipipe_timer {
const char *name; const char *name;
unsigned rating; unsigned rating;
unsigned long freq; unsigned long freq;
unsigned min_delay_ticks; unsigned long min_delay_ticks;
unsigned long max_delay_ticks;
const struct cpumask *cpumask; const struct cpumask *cpumask;
/* For internal use */ /* For internal use */
......
...@@ -133,6 +133,10 @@ void ipipe_host_timer_register(struct clock_event_device *evtdev) ...@@ -133,6 +133,10 @@ void ipipe_host_timer_register(struct clock_event_device *evtdev)
timer->min_delay_ticks = timer->min_delay_ticks =
(evtdev->min_delta_ns * evtdev->mult) >> evtdev->shift; (evtdev->min_delta_ns * evtdev->mult) >> evtdev->shift;
if (timer->max_delay_ticks == 0)
timer->max_delay_ticks =
(evtdev->max_delta_ns * evtdev->mult) >> evtdev->shift;
if (timer->cpumask == NULL) if (timer->cpumask == NULL)
timer->cpumask = evtdev->cpumask; timer->cpumask = evtdev->cpumask;
...@@ -499,6 +503,8 @@ void ipipe_timer_set(unsigned long cdelay) ...@@ -499,6 +503,8 @@ void ipipe_timer_set(unsigned long cdelay)
tdelay += ((unsigned long long)cdelay * t->c2t_frac) >> 32; tdelay += ((unsigned long long)cdelay * t->c2t_frac) >> 32;
if (tdelay < t->min_delay_ticks) if (tdelay < t->min_delay_ticks)
tdelay = t->min_delay_ticks; tdelay = t->min_delay_ticks;
if (tdelay > t->max_delay_ticks)
tdelay = t->max_delay_ticks;
if (t->set(tdelay, t->timer_set) < 0) if (t->set(tdelay, t->timer_set) < 0)
ipipe_raise_irq(t->irq); ipipe_raise_irq(t->irq);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment