[svn-commits] sruffell: linux/trunk r9580 - /linux/trunk/drivers/dahdi/dahdi_dynamic.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Jan 3 18:26:08 UTC 2011
Author: sruffell
Date: Mon Jan 3 12:26:04 2011
New Revision: 9580
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9580
Log:
dahdi_dynamic: Do not depend on BKL for serialization of dspan creation.
Also makes it safe to unregister a dynamic driver when there aren't any
open channels on the dynamic spans.
Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Acked-by: Kinsey Moore <kmoore at digium.com>
Modified:
linux/trunk/drivers/dahdi/dahdi_dynamic.c
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=9580&r1=9579&r2=9580
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi_dynamic.c (original)
+++ linux/trunk/drivers/dahdi/dahdi_dynamic.c Mon Jan 3 12:26:04 2011
@@ -90,6 +90,7 @@
static void dahdi_dynamic_tasklet(unsigned long data);
#endif
+static DEFINE_MUTEX(dspan_mutex);
static DEFINE_SPINLOCK(dspan_lock);
static DEFINE_SPINLOCK(driver_lock);
@@ -456,7 +457,7 @@
return found;
}
-static int destroy_dynamic(struct dahdi_dynamic_span *dds)
+static int _destroy_dynamic(struct dahdi_dynamic_span *dds)
{
unsigned long flags;
struct dahdi_dynamic *d;
@@ -484,6 +485,15 @@
/* ...and one for find_dynamic. */
dynamic_put(d);
return 0;
+}
+
+static int destroy_dynamic(struct dahdi_dynamic_span *dds)
+{
+ int ret;
+ mutex_lock(&dspan_mutex);
+ ret = _destroy_dynamic(dds);
+ mutex_unlock(&dspan_mutex);
+ return ret;
}
static int dahdi_dynamic_rbsbits(struct dahdi_chan *chan, int bits)
@@ -541,7 +551,7 @@
.sync_tick = dahdi_dynamic_sync_tick,
};
-static int create_dynamic(struct dahdi_dynamic_span *dds)
+static int _create_dynamic(struct dahdi_dynamic_span *dds)
{
int res = 0;
struct dahdi_dynamic *d;
@@ -671,6 +681,15 @@
module_put(dtd->owner);
return x;
+}
+
+static int create_dynamic(struct dahdi_dynamic_span *dds)
+{
+ int ret;
+ mutex_lock(&dspan_mutex);
+ ret = _create_dynamic(dds);
+ mutex_unlock(&dspan_mutex);
+ return ret;
}
#ifdef ENABLE_TASKLETS
@@ -740,6 +759,8 @@
struct dahdi_dynamic *d, *n;
unsigned long flags;
+ mutex_lock(&dspan_mutex);
+
list_for_each_entry_safe(d, n, &dspan_list, list) {
if (d->driver == dri) {
if (d->pvt) {
@@ -764,6 +785,8 @@
list_del_rcu(&dri->list);
spin_unlock_irqrestore(&driver_lock, flags);
synchronize_rcu();
+
+ mutex_unlock(&dspan_mutex);
}
EXPORT_SYMBOL(dahdi_dynamic_unregister_driver);
More information about the svn-commits
mailing list