[dahdi-commits] sruffell: linux/trunk r9588 - /linux/trunk/drivers/dahdi/dahdi-base.c
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Mon Jan 3 18:26:47 UTC 2011
Author: sruffell
Date: Mon Jan 3 12:26:43 2011
New Revision: 9588
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9588
Log:
dahdi: Use a spinlock instead of a rwlock for 'zone_lock'
rwlocks are deprecated and there aren't that many places where read_lock
was called on the lock anyway.
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
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=9588&r1=9587&r2=9588
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Mon Jan 3 12:26:43 2011
@@ -375,11 +375,7 @@
struct dahdi_tone mfr2_rev_continuous[16]; /* MFR2 REV tones for this zone, continuous play */
};
-#ifdef DEFINE_RWLOCK
-static DEFINE_RWLOCK(zone_lock);
-#else
-static rwlock_t zone_lock = RW_LOCK_UNLOCKED;
-#endif
+static DEFINE_SPINLOCK(zone_lock);
static DEFINE_SPINLOCK(chan_lock);
@@ -1384,7 +1380,7 @@
if ((num >= DAHDI_TONE_ZONE_MAX) || (num < 0))
return -EINVAL;
- write_lock(&zone_lock);
+ spin_lock(&zone_lock);
if (tone_zones[num]) {
if (!atomic_read(&tone_zones[num]->refcount)) {
z = tone_zones[num];
@@ -1393,7 +1389,7 @@
res = -EBUSY;
}
}
- write_unlock(&zone_lock);
+ spin_unlock(&zone_lock);
if (z)
kfree(z);
@@ -1408,14 +1404,14 @@
if ((num >= DAHDI_TONE_ZONE_MAX) || (num < 0))
return -EINVAL;
- write_lock(&zone_lock);
+ spin_lock(&zone_lock);
if (tone_zones[num]) {
res = -EINVAL;
} else {
res = 0;
tone_zones[num] = zone;
}
- write_unlock(&zone_lock);
+ spin_unlock(&zone_lock);
if (!res)
module_printk(KERN_INFO, "Registered tone zone %d (%s)\n", num, zone->name);
@@ -1532,7 +1528,7 @@
if ((zone >= DAHDI_TONE_ZONE_MAX) || (zone < 0))
return -EINVAL;
- read_lock(&zone_lock);
+ spin_lock(&zone_lock);
if ((z = tone_zones[zone])) {
unsigned long flags;
@@ -1552,7 +1548,7 @@
res = -ENODATA;
}
- read_unlock(&zone_lock);
+ spin_unlock(&zone_lock);
return res;
}
@@ -2963,16 +2959,16 @@
{
if ((defzone < 0) || (defzone >= DAHDI_TONE_ZONE_MAX))
return -EINVAL;
- write_lock(&zone_lock);
+ spin_lock(&zone_lock);
if (!tone_zones[defzone]) {
- write_unlock(&zone_lock);
+ spin_unlock(&zone_lock);
return -EINVAL;
}
if ((default_zone != -1) && tone_zones[default_zone])
atomic_dec(&tone_zones[default_zone]->refcount);
atomic_inc(&tone_zones[defzone]->refcount);
default_zone = defzone;
- write_unlock(&zone_lock);
+ spin_unlock(&zone_lock);
return 0;
}
@@ -4596,7 +4592,7 @@
}
/* update the lengths in all currently loaded zones */
- write_lock(&zone_lock);
+ spin_lock(&zone_lock);
for (j = 0; j < ARRAY_SIZE(tone_zones); j++) {
struct dahdi_zone *z = tone_zones[j];
@@ -4620,7 +4616,7 @@
z->mfr2_rev[i].tonesamples = global_dialparams.mfr2_tonelen * DAHDI_CHUNKSIZE;
}
}
- write_unlock(&zone_lock);
+ spin_unlock(&zone_lock);
dtmf_silence.tonesamples = global_dialparams.dtmf_tonelen * DAHDI_CHUNKSIZE;
mfr1_silence.tonesamples = global_dialparams.mfv1_tonelen * DAHDI_CHUNKSIZE;
More information about the dahdi-commits
mailing list