dde_linux: remove timer optimization

Instead of storing whether the first item in the timeout list was already
programmed using the timer service, just program the first timeout in the
list unconditionally. In the past we lost a timeout at least when using the
usb ethernet driver on hw/arndale sporadically.
This commit is contained in:
Stefan Kalkowski 2017-11-09 15:34:41 +01:00 committed by Christian Helmuth
parent 44adc3c404
commit 83a88d46b7
2 changed files with 4 additions and 34 deletions

View File

@ -57,7 +57,6 @@ class Lx::Timer
void *timer;
bool pending { false };
unsigned long timeout { INVALID_TIMEOUT }; /* absolute in jiffies */
bool programmed { false };
Context(struct timer_list *timer) : type(LIST), timer(timer) { }
@ -111,11 +110,6 @@ class Lx::Timer
/**
* Program the first timer in the list
*
* The first timer is programmed if the 'programmed' flag was not set
* before. The second timer is flagged as not programmed as
* 'Timer::trigger_once' invalidates former registered one-shot
* timeouts.
*/
void _program_first_timer()
{
@ -123,19 +117,10 @@ class Lx::Timer
if (!ctx)
return;
if (ctx->programmed)
return;
/* calculate relative microseconds for trigger */
unsigned long us = ctx->timeout > jiffies ?
jiffies_to_msecs(ctx->timeout - jiffies) * 1000 : 0;
_timer_conn.trigger_once(us);
ctx->programmed = true;
/* possibly programmed successor must be reprogrammed later */
if (Context *next = ctx->next())
next->programmed = false;
}
/**
@ -150,10 +135,10 @@ class Lx::Timer
ctx->timeout = expires;
ctx->pending = true;
ctx->programmed = false;
/*
* Also write the timeout value to the expires field in
* struct timer_list because the checks
* struct timer_list because some code the checks
* it directly.
*/
ctx->expires(expires);

View File

@ -44,7 +44,6 @@ class Lx_kit::Timer : public Lx::Timer
void *timer;
bool pending { false };
unsigned long timeout { INVALID_TIMEOUT }; /* absolute in jiffies */
bool programmed { false };
Context(struct timer_list *timer) : type(LIST), timer(timer) { }
Context(struct hrtimer *timer) : type(HR), timer(timer) { }
@ -101,11 +100,6 @@ class Lx_kit::Timer : public Lx::Timer
/**
* Program the first timer in the list
*
* The first timer is programmed if the 'programmed' flag was not set
* before. The second timer is flagged as not programmed as
* 'Timer::trigger_once' invalidates former registered one-shot
* timeouts.
*/
void _program_first_timer()
{
@ -113,19 +107,10 @@ class Lx_kit::Timer : public Lx::Timer
if (!ctx)
return;
if (ctx->programmed)
return;
/* calculate relative microseconds for trigger */
unsigned long us = ctx->timeout > _jiffies ?
jiffies_to_msecs(ctx->timeout - _jiffies) * 1000 : 0;
_timer_conn.trigger_once(us);
ctx->programmed = true;
/* possibly programmed successor must be reprogrammed later */
if (Context *next = ctx->next())
next->programmed = false;
}
/**
@ -140,10 +125,10 @@ class Lx_kit::Timer : public Lx::Timer
ctx->timeout = expires;
ctx->pending = true;
ctx->programmed = false;
/*
* Also write the timeout value to the expires field in
* struct timer_list because the wireless stack checks
* struct timer_list because some code the checks
* it directly.
*/
ctx->expires(expires);