From f4d9cbbfb15839334b512156d20403b8a986a913 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 4 Apr 2013 14:42:52 -0500 Subject: [PATCH] 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 --- drivers/dahdi/dahdi-base.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index f73fd01..a3540d1 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -5366,7 +5366,8 @@ static int dahdi_ioctl_maint(unsigned long data) spin_lock_irqsave(&s->lock, flags); /* save current maint state */ i = s->maintstat; - + /* set maint mode */ + s->maintstat = maint.command; switch (maint.command) { case DAHDI_MAINT_NONE: case DAHDI_MAINT_LOCALLOOP: @@ -5379,6 +5380,8 @@ static int dahdi_ioctl_maint(unsigned long data) spin_unlock_irqrestore(&s->lock, flags); if (rv) { put_span(s); + /* Restore the state on error */ + s->maintstat = i; return rv; } spin_lock_irqsave(&s->lock, flags); @@ -5390,6 +5393,8 @@ static int dahdi_ioctl_maint(unsigned long data) spin_unlock_irqrestore(&s->lock, flags); if (rv) { put_span(s); + /* Restore the state on error */ + s->maintstat = i; return rv; } spin_lock_irqsave(&s->lock, flags); @@ -5413,6 +5418,8 @@ static int dahdi_ioctl_maint(unsigned long data) spin_unlock_irqrestore(&s->lock, flags); if (rv) { put_span(s); + /* Restore the state on error */ + s->maintstat = i; return rv; } spin_lock_irqsave(&s->lock, flags); @@ -5423,12 +5430,10 @@ static int dahdi_ioctl_maint(unsigned long data) "Unknown maintenance event: %d\n", maint.command); put_span(s); + /* Restore the state on error */ + s->maintstat = i; return -ENOSYS; } - - /* set maint mode */ - s->maintstat = maint.command; - dahdi_alarm_notify(s); /* process alarm-related events */ spin_unlock_irqrestore(&s->lock, flags); put_span(s);