From d4ac65d0c1f6714df708b0bb2a046857b83a8944 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Tue, 20 Jun 2017 14:41:14 +0300 Subject: [PATCH] xpp: fxo: update red alarms on span assignment DAHDI gets notified of changes to battery status and hence to red alarm on an FXO channel when the status changes. It thus needs to get notified about it on "startup". This startup was initially span registration. However following the separation between device registration and span assignment, the notification was sent after device registration, whereas it was ignored if span was not assigned. It happened to work in most cases due to delays. This fix moves the startup notifications of battery status to the new hook that is run on span assignment. Signed-off-by: Tzafrir Cohen --- drivers/dahdi/xpp/card_fxo.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/dahdi/xpp/card_fxo.c b/drivers/dahdi/xpp/card_fxo.c index b4cdabd..1dbd299 100644 --- a/drivers/dahdi/xpp/card_fxo.c +++ b/drivers/dahdi/xpp/card_fxo.c @@ -620,7 +620,6 @@ static int FXO_card_dahdi_postregistration(xpd_t *xpd, bool on) BUG_ON(!priv); XPD_DBG(GENERAL, xpd, "%s\n", (on) ? "ON" : "OFF"); for_each_line(xpd, i) { - dahdi_report_battery(xpd, i); MARK_OFF(priv, i, LED_GREEN); msleep(2); MARK_OFF(priv, i, LED_RED); @@ -629,6 +628,23 @@ static int FXO_card_dahdi_postregistration(xpd_t *xpd, bool on) return 0; } +static int FXO_span_assigned(xpd_t *xpd) +{ + xbus_t *xbus; + struct FXO_priv_data *priv; + int i; + + BUG_ON(!xpd); + xbus = xpd->xbus; + BUG_ON(!xbus); + priv = xpd->priv; + BUG_ON(!priv); + XPD_DBG(GENERAL, xpd, "\n"); + for_each_line(xpd, i) + dahdi_report_battery(xpd, i); + return 0; +} + static int FXO_card_hooksig(xpd_t *xpd, int pos, enum dahdi_txsig txsig) { struct FXO_priv_data *priv; @@ -1314,6 +1330,7 @@ static const struct phoneops fxo_phoneops = { .card_ioctl = FXO_card_ioctl, .card_open = FXO_card_open, .card_state = FXO_card_state, + .span_assigned = FXO_span_assigned, }; static xproto_table_t PROTO_TABLE(FXO) = {