[svn-commits] sruffell: branch linux/sruffell/chan_list_refactoring r9278 - /linux/team/sru...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Sep 2 12:41:23 CDT 2010


Author: sruffell
Date: Thu Sep  2 12:41:11 2010
New Revision: 9278

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

Modified:
    linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c

Modified: linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c?view=diff&rev=9278&r1=9277&r2=9278
==============================================================================
--- linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/sruffell/chan_list_refactoring/drivers/dahdi/dahdi-base.c Thu Sep  2 12:41:11 2010
@@ -2852,19 +2852,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;
 
@@ -2872,9 +2874,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;
@@ -3517,12 +3516,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");
@@ -3530,7 +3529,7 @@
 		}
 		return res;
 	}
-	return dahdi_specchan_release(file, unit);
+	return dahdi_specchan_release(file);
 }
 
 #if 0




More information about the svn-commits mailing list