dahdi: Move clearing of DAHDI_ALARM_NOTOPEN to __dahdi_assign_span().
Previously this was in __dahdi_init_span(). The problem was that
__dahdi_init_span() was only called when a spans' line mode was being changed.
Therefore it was possible to unassign and resassign an analog span and leave it
stuck in the 'NOP' alarm state.
It also make the setting / clearing of DAHDI_ALARM_NOTOPEN symetrical about span
unassignment / assignment in addition to updating the alarm states on all the
channels on the span via the dahdi_alarm_notify() function.
This is a better version of commit 496f817773
.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
This commit is contained in:
parent
3933ffd350
commit
e6b16eace1
@ -7188,13 +7188,6 @@ 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",
|
||||
@ -7255,6 +7248,7 @@ static int _dahdi_assign_span(struct dahdi_span *span, unsigned int spanno,
|
||||
{
|
||||
int res = 0;
|
||||
unsigned int x;
|
||||
unsigned long flags;
|
||||
|
||||
if (!span || !span->ops || !span->ops->owner)
|
||||
return -EFAULT;
|
||||
@ -7266,6 +7260,16 @@ static int _dahdi_assign_span(struct dahdi_span *span, unsigned int spanno,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* DAHDI_ALARM_NOTOPEN can be set when a span is disabled, i.e. via
|
||||
* sysfs, so when the span is being reassigned we should make sure it's
|
||||
* cleared. This eliminates the need for board drivers to re-report
|
||||
* their alarm states on span reassignment. */
|
||||
|
||||
spin_lock_irqsave(&span->lock, flags);
|
||||
span->alarms &= ~DAHDI_ALARM_NOTOPEN;
|
||||
dahdi_alarm_notify(span);
|
||||
spin_unlock_irqrestore(&span->lock, flags);
|
||||
|
||||
if (span->ops->enable_hw_preechocan ||
|
||||
span->ops->disable_hw_preechocan) {
|
||||
if ((NULL == span->ops->enable_hw_preechocan) ||
|
||||
|
Loading…
Reference in New Issue
Block a user