[dahdi-commits] sruffell: linux/trunk r9373 - /linux/trunk/drivers/dahdi/dahdi-base.c

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Mon Sep 20 15:33:55 CDT 2010


Author: sruffell
Date: Mon Sep 20 15:33:51 2010
New Revision: 9373

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9373
Log:
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 at digium.com>

Modified:
    linux/trunk/drivers/dahdi/dahdi-base.c

Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=9373&r1=9372&r2=9373
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Mon Sep 20 15:33:51 2010
@@ -2823,19 +2823,21 @@
 	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 @@
 				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 @@
 		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 @@
 		}
 		return res;
 	}
-	return dahdi_specchan_release(file, unit);
+	return dahdi_specchan_release(file);
 }
 
 #if 0




More information about the dahdi-commits mailing list