From 496f81777323d309bd5c32afc2186bdc0055e5be Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 24 Oct 2013 11:54:46 -0500 Subject: [PATCH] dahdi: Clear DAHDI_ALARM_NOTOPEN when spans are re-initialized. This eliminates the need for board drivers to always re-report their alarm states when spans are unassigned and then reassigned. Signed-off-by: Shaun Ruffell --- drivers/dahdi/dahdi-base.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index eff2957..773b8a1 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -7153,6 +7153,13 @@ static void __dahdi_init_span(struct dahdi_span *span) spin_lock_init(&span->lock); clear_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags); + /* DAHDI_ALARM_NOTOPEN can be set when a span is disabled, i.e. via + * sysfs, so when the span is being initialized again before + * reassignment we should make sure it's cleared. This eliminates the + * need for board drivers to re-report their alarm states on span + * reassignment. */ + span->alarms &= ~DAHDI_ALARM_NOTOPEN; + if (!span->deflaw) { module_printk(KERN_NOTICE, "Span %s didn't specify default " "law. Assuming mulaw, please fix driver!\n",