wctdm24xxp: Use framecount and not jiffies when looking for battery present.
The logic to check for battery lost and battery present were using different
time bases. One was using jiffies and the other was using framecount. Since
framecount is always in milliseconds, let's use that to stay consistent.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
(cherry picked from commit a6be603590)
This commit is contained in:
committed by
Russ Meyerriecks
parent
33b4edf463
commit
e3931e5d5f
@@ -2023,7 +2023,7 @@ wctdm_check_battery_present(struct wctdm *wc, struct wctdm_module *const mod)
|
||||
|
||||
switch (fxo->battery_state) {
|
||||
case BATTERY_DEBOUNCING_PRESENT:
|
||||
if (time_after(jiffies, fxo->battdebounce_timer)) {
|
||||
if (time_after(wc->framecount, fxo->battdebounce_timer)) {
|
||||
if (debug) {
|
||||
dev_info(&wc->vb.pdev->dev,
|
||||
"BATTERY on %d/%d (%s)!\n",
|
||||
@@ -2048,12 +2048,12 @@ wctdm_check_battery_present(struct wctdm *wc, struct wctdm_module *const mod)
|
||||
* of its time period has already passed while
|
||||
* debouncing occurred */
|
||||
fxo->battery_state = BATTERY_DEBOUNCING_PRESENT_ALARM;
|
||||
fxo->battdebounce_timer = jiffies +
|
||||
msecs_to_jiffies(battalarm - battdebounce);
|
||||
fxo->battdebounce_timer = wc->framecount +
|
||||
battalarm - battdebounce;
|
||||
}
|
||||
break;
|
||||
case BATTERY_DEBOUNCING_PRESENT_ALARM:
|
||||
if (time_after(jiffies, fxo->battdebounce_timer)) {
|
||||
if (time_after(wc->framecount, fxo->battdebounce_timer)) {
|
||||
fxo->battery_state = BATTERY_PRESENT;
|
||||
dahdi_alarm_channel(get_dahdi_chan(wc, mod),
|
||||
DAHDI_ALARM_NONE);
|
||||
@@ -2071,8 +2071,7 @@ wctdm_check_battery_present(struct wctdm *wc, struct wctdm_module *const mod)
|
||||
case BATTERY_LOST: /* intentional drop through */
|
||||
case BATTERY_DEBOUNCING_LOST_ALARM:
|
||||
fxo->battery_state = BATTERY_DEBOUNCING_PRESENT;
|
||||
fxo->battdebounce_timer = jiffies +
|
||||
msecs_to_jiffies(battdebounce);
|
||||
fxo->battdebounce_timer = wc->framecount + battdebounce;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user