[svn-commits] sruffell: linux/trunk r9576 - /linux/trunk/drivers/dahdi/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jan 3 18:25:51 UTC 2011


Author: sruffell
Date: Mon Jan  3 12:25:45 2011
New Revision: 9576

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9576
Log:
dahdi_dynamic: Use dahdi_span_ops.sync_tick for driving dynamic spans.

Dynamic spans that are unable to provide their own timing, like dahdi
local spans, typically derived their timing source from
dahdi_dynamic_ioctl(0,0) call in process_masterspan.

This change uses the sync_tick member of dahdi_span_ops instead so that
dynamic operations do not happen on a span until it is fully registered.
Also removes the check for dahdi_dynamic_ioctl in process masterspan for
those users that never load a dynamic span.

This was originally suggested in a comment on:
(issue #13205)

Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Acked-by: Kinsey Moore <kmoore at digium.com>

Modified:
    linux/trunk/drivers/dahdi/dahdi-base.c
    linux/trunk/drivers/dahdi/dahdi_dynamic.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=9576&r1=9575&r2=9576
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Mon Jan  3 12:25:45 2011
@@ -8458,10 +8458,6 @@
 
 	/* Process any timers */
 	process_timers();
-	/* If we have dynamic stuff, call the ioctl with 0,0 parameters to
-	   make it run */
-	if (dahdi_dynamic_ioctl)
-		dahdi_dynamic_ioctl(0, 0);
 
 	for (y = 1; y < maxspans; ++y) {
 		s = spans[y];

Modified: linux/trunk/drivers/dahdi/dahdi_dynamic.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi_dynamic.c?view=diff&rev=9576&r1=9575&r2=9576
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi_dynamic.c (original)
+++ linux/trunk/drivers/dahdi/dahdi_dynamic.c Mon Jan  3 12:25:45 2011
@@ -34,6 +34,10 @@
 #include <linux/moduleparam.h>
 
 #include <dahdi/kernel.h>
+
+#ifndef DAHDI_SYNC_TICK
+#error "Dynamic support depends on DAHDI_SYNC_TICK being enabled."
+#endif
 
 /*
  * Tasklets provide better system interactive response at the cost of the
@@ -533,12 +537,30 @@
 	return 0;
 }
 
+static int dahdi_dynamic_sync_tick(struct dahdi_span *span, int is_master)
+{
+	struct dahdi_dynamic *head;
+	struct dahdi_dynamic *d = dynamic_from_span(span);
+
+	if (hasmaster)
+		return 0;
+
+	rcu_read_lock();
+	head = list_entry(dspan_list.next, struct dahdi_dynamic, list);
+	rcu_read_unlock();
+
+	if (d == head)
+		dahdi_dynamic_run();
+	return 0;
+}
+
 static const struct dahdi_span_ops dynamic_ops = {
 	.owner = THIS_MODULE,
 	.rbsbits = dahdi_dynamic_rbsbits,
 	.open = dahdi_dynamic_open,
 	.close = dahdi_dynamic_close,
 	.chanconfig = dahdi_dynamic_chanconfig,
+	.sync_tick = dahdi_dynamic_sync_tick,
 };
 
 static int create_dynamic(struct dahdi_dynamic_span *dds)
@@ -689,13 +711,6 @@
 	struct dahdi_dynamic_span dds;
 	int res;
 	switch(cmd) {
-	case 0:
-		/* This is called just before rotation.  If none of our
-		   spans are pulling timing, then now is the time to process
-		   them */
-		if (!hasmaster)
-			dahdi_dynamic_run();
-		return 0;
 	case DAHDI_DYNAMIC_CREATE:
 		if (copy_from_user(&dds, (__user const void *)data,
 				   sizeof(dds)))




More information about the svn-commits mailing list