Skip to content

Commit f4d9cbb

Browse files
committed
dahdi: Save the current maintstat in the span before calling into the drivers.
Some of the card callbacks needed maintstat set when processing loopup codes from the remote side. This change is a modification of commit: (6c02c3c "dahdi-base: Minor maint mode error") Without this change cetain cards would not properly process the loopup / loopdown codes (I know I should have more specific information here but the details escape me at the moment). Signed-off-by: Shaun Ruffell <[email protected]>
1 parent a878869 commit f4d9cbb

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/dahdi/dahdi-base.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5366,7 +5366,8 @@ static int dahdi_ioctl_maint(unsigned long data)
53665366
spin_lock_irqsave(&s->lock, flags);
53675367
/* save current maint state */
53685368
i = s->maintstat;
5369-
5369+
/* set maint mode */
5370+
s->maintstat = maint.command;
53705371
switch (maint.command) {
53715372
case DAHDI_MAINT_NONE:
53725373
case DAHDI_MAINT_LOCALLOOP:
@@ -5379,6 +5380,8 @@ static int dahdi_ioctl_maint(unsigned long data)
53795380
spin_unlock_irqrestore(&s->lock, flags);
53805381
if (rv) {
53815382
put_span(s);
5383+
/* Restore the state on error */
5384+
s->maintstat = i;
53825385
return rv;
53835386
}
53845387
spin_lock_irqsave(&s->lock, flags);
@@ -5390,6 +5393,8 @@ static int dahdi_ioctl_maint(unsigned long data)
53905393
spin_unlock_irqrestore(&s->lock, flags);
53915394
if (rv) {
53925395
put_span(s);
5396+
/* Restore the state on error */
5397+
s->maintstat = i;
53935398
return rv;
53945399
}
53955400
spin_lock_irqsave(&s->lock, flags);
@@ -5413,6 +5418,8 @@ static int dahdi_ioctl_maint(unsigned long data)
54135418
spin_unlock_irqrestore(&s->lock, flags);
54145419
if (rv) {
54155420
put_span(s);
5421+
/* Restore the state on error */
5422+
s->maintstat = i;
54165423
return rv;
54175424
}
54185425
spin_lock_irqsave(&s->lock, flags);
@@ -5423,12 +5430,10 @@ static int dahdi_ioctl_maint(unsigned long data)
54235430
"Unknown maintenance event: %d\n",
54245431
maint.command);
54255432
put_span(s);
5433+
/* Restore the state on error */
5434+
s->maintstat = i;
54265435
return -ENOSYS;
54275436
}
5428-
5429-
/* set maint mode */
5430-
s->maintstat = maint.command;
5431-
54325437
dahdi_alarm_notify(s); /* process alarm-related events */
54335438
spin_unlock_irqrestore(&s->lock, flags);
54345439
put_span(s);

0 commit comments

Comments
 (0)