dahdi: Completely stop spans when unassigning.
When spans are unassigned, dahdi_span_ops.shutdown was called, but the RUNNING flag was never cleared. Now make sure all calls to the shutdown span ops callback are the same. Signed-off-by: Shaun Ruffell <sruffell@digium.com> Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
This commit is contained in:
parent
a3ad32c370
commit
9b11847aee
@ -5137,11 +5137,28 @@ static int dahdi_ioctl_startup(struct file *file, unsigned long data)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int dahdi_shutdown_span(struct dahdi_span *s)
|
||||||
|
{
|
||||||
|
int res = 0;
|
||||||
|
int x;
|
||||||
|
|
||||||
|
/* Unconfigure channels */
|
||||||
|
for (x = 0; x < s->channels; x++)
|
||||||
|
s->chans[x]->sig = 0;
|
||||||
|
|
||||||
|
if (s->ops->shutdown)
|
||||||
|
res = s->ops->shutdown(s);
|
||||||
|
|
||||||
|
clear_bit(DAHDI_FLAGBIT_RUNNING, &s->flags);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static int dahdi_ioctl_shutdown(unsigned long data)
|
static int dahdi_ioctl_shutdown(unsigned long data)
|
||||||
{
|
{
|
||||||
|
int res;
|
||||||
/* I/O CTL's for control interface */
|
/* I/O CTL's for control interface */
|
||||||
int j;
|
int j;
|
||||||
int x;
|
|
||||||
struct dahdi_span *s;
|
struct dahdi_span *s;
|
||||||
|
|
||||||
if (get_user(j, (int __user *)data))
|
if (get_user(j, (int __user *)data))
|
||||||
@ -5149,22 +5166,9 @@ static int dahdi_ioctl_shutdown(unsigned long data)
|
|||||||
s = span_find_and_get(j);
|
s = span_find_and_get(j);
|
||||||
if (!s)
|
if (!s)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
res = dahdi_shutdown_span(s);
|
||||||
/* Unconfigure channels */
|
|
||||||
for (x = 0; x < s->channels; x++)
|
|
||||||
s->chans[x]->sig = 0;
|
|
||||||
|
|
||||||
if (s->ops->shutdown) {
|
|
||||||
int res = s->ops->shutdown(s);
|
|
||||||
if (res) {
|
|
||||||
put_span(s);
|
put_span(s);
|
||||||
return res;
|
return res;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
s->flags &= ~DAHDI_FLAG_RUNNING;
|
|
||||||
put_span(s);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -7424,6 +7428,7 @@ static void disable_span(struct dahdi_span *span)
|
|||||||
*/
|
*/
|
||||||
static int _dahdi_unassign_span(struct dahdi_span *span)
|
static int _dahdi_unassign_span(struct dahdi_span *span)
|
||||||
{
|
{
|
||||||
|
int res;
|
||||||
int x;
|
int x;
|
||||||
struct dahdi_span *new_master, *s;
|
struct dahdi_span *new_master, *s;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
@ -7440,9 +7445,11 @@ static int _dahdi_unassign_span(struct dahdi_span *span)
|
|||||||
span->spanno = 0;
|
span->spanno = 0;
|
||||||
clear_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags);
|
clear_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags);
|
||||||
|
|
||||||
/* Shutdown the span if it's running */
|
res = dahdi_shutdown_span(span);
|
||||||
if ((span->flags & DAHDI_FLAG_RUNNING) && span->ops->shutdown)
|
if (res) {
|
||||||
span->ops->shutdown(span);
|
dev_err(span_device(span),
|
||||||
|
"Failed to shutdown when unassigning.\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (debug & DEBUG_MAIN)
|
if (debug & DEBUG_MAIN)
|
||||||
module_printk(KERN_NOTICE, "Unassigning Span '%s' with %d channels\n", span->name, span->channels);
|
module_printk(KERN_NOTICE, "Unassigning Span '%s' with %d channels\n", span->name, span->channels);
|
||||||
|
Loading…
Reference in New Issue
Block a user