summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2010-09-20 20:33:51 +0000
committerShaun Ruffell <sruffell@digium.com>2010-09-20 20:33:51 +0000
commit694567244e1f906961fa3b94a8cdc083f66680e9 (patch)
tree2fe8a6178082dc0b51f7243c081c72ee6d8ae786 /drivers
parentd16e412bd424d8c325e160882785b3a8c2a47f1e (diff)
dahdi: Remove unit parameter from dahdi_specchan_release.
This change also involves setting the DAHDI_FLAGBIT_CLOSE bit on the channel before calling the 'close' callback in span ops. It appears that only the dynamic spans may delete the channels on close, but that code path doesn't check the DAHDI_FLAGBIT_CLOSE bit anyway. Review: https://reviewboard.asterisk.org/r/905/ Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9373 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dahdi/dahdi-base.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index edcae00..9c9ea48 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -2823,19 +2823,21 @@ static int dahdi_specchan_open(struct file *file)
return res;
}
-static int dahdi_specchan_release(struct file *file, int unit)
+static int dahdi_specchan_release(struct file *file)
{
int res=0;
unsigned long flags;
- struct dahdi_chan *const chan = chans[unit];
+ struct dahdi_chan *chan = chan_from_file(file);
if (chan) {
/* Chan lock protects contents against potentially non atomic accesses.
* So if the pointer setting is not atomic, we should protect */
spin_lock_irqsave(&chan->lock, flags);
chan->file = NULL;
+ file->private_data = NULL;
spin_unlock_irqrestore(&chan->lock, flags);
close_channel(chan);
+ clear_bit(DAHDI_FLAGBIT_OPEN, &chan->flags);
if (chan->span) {
struct module *owner = chan->span->ops->owner;
@@ -2843,9 +2845,6 @@ static int dahdi_specchan_release(struct file *file, int unit)
res = chan->span->ops->close(chan);
module_put(owner);
}
- /* The channel might be destroyed by low-level driver span->close() */
- if (chans[unit])
- clear_bit(DAHDI_FLAGBIT_OPEN, &chans[unit]->flags);
} else
res = -ENXIO;
return res;
@@ -3488,12 +3487,12 @@ static int dahdi_release(struct inode *inode, struct file *file)
if (!chan)
return dahdi_chan_release(file);
else
- return dahdi_specchan_release(file, chan->channo);
+ return dahdi_specchan_release(file);
}
if (unit == 255) {
chan = file->private_data;
if (chan) {
- res = dahdi_specchan_release(file, chan->channo);
+ res = dahdi_specchan_release(file);
dahdi_free_pseudo(chan);
} else {
module_printk(KERN_NOTICE, "Pseudo release and no private data??\n");
@@ -3501,7 +3500,7 @@ static int dahdi_release(struct inode *inode, struct file *file)
}
return res;
}
- return dahdi_specchan_release(file, unit);
+ return dahdi_specchan_release(file);
}
#if 0