From ebf8bded3f539c61a5a99e1d43214d1b0228396a Mon Sep 17 00:00:00 2001 From: kpfleming Date: Wed, 31 Aug 2005 21:43:39 +0000 Subject: make spinlock definitions compatible with -RT kernel patches (and future kernel syntax) (issue #5080) git-svn-id: http://svn.digium.com/svn/zaptel/branches/v1-0@752 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- tor2.c | 4 ++++ torisa.c | 4 ++++ zaptel.c | 11 ++++++++++- ztd-eth.c | 5 ++++- ztdummy.c | 4 ++++ ztdynamic.c | 6 ++++-- 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/tor2.c b/tor2.c index 013f223..7ee9f81 100755 --- a/tor2.c +++ b/tor2.c @@ -1087,7 +1087,11 @@ static void tor2_tasklet(unsigned long data) static int syncsrc = 0; static int syncnum = 0 /* -1 */; static int syncspan = 0; +#ifdef DEFINE_SPINLOCK +static DEFINE_SPINLOCK(synclock); +#else static spinlock_t synclock = SPIN_LOCK_UNLOCKED; +#endif static int tor2_findsync(struct tor2 *tor) { diff --git a/torisa.c b/torisa.c index 53b49fc..5bee0ed 100755 --- a/torisa.c +++ b/torisa.c @@ -130,7 +130,11 @@ static int prefmaster = 0; static int spansstarted = 0; +#ifdef DEFINE_RWLOCK +static DEFINE_RWLOCK(torisa); +#else static rwlock_t torisa = RW_LOCK_UNLOCKED; +#endif static u_char readdata[2][64][ZT_MAX_CHUNKSIZE]; static u_char writedata[2][64][ZT_MAX_CHUNKSIZE]; diff --git a/zaptel.c b/zaptel.c index 714fc66..ac85f01 100755 --- a/zaptel.c +++ b/zaptel.c @@ -329,9 +329,13 @@ static struct zt_timer { wait_queue_head_t sel; } *zaptimers = NULL; +#ifdef DEFINE_SPINLOCK +static DEFINE_SPINLOCK(zaptimerlock); +static DEFINE_SPINLOCK(bigzaplock); +#else static spinlock_t zaptimerlock = SPIN_LOCK_UNLOCKED; - static spinlock_t bigzaplock = SPIN_LOCK_UNLOCKED; +#endif struct zt_zone { char name[40]; /* Informational, only */ @@ -364,8 +368,13 @@ u_char __zt_lin2a[16384]; static u_char defgain[256]; +#ifdef DEFINE_RWLOCK +static DEFINE_RWLOCK(zone_lock); +static DEFINE_RWLOCK(chan_lock); +#else static rwlock_t zone_lock = RW_LOCK_UNLOCKED; static rwlock_t chan_lock = RW_LOCK_UNLOCKED; +#endif static struct zt_zone *tone_zones[ZT_TONE_ZONE_MAX]; diff --git a/ztd-eth.c b/ztd-eth.c index 62e4382..e6436ea 100755 --- a/ztd-eth.c +++ b/ztd-eth.c @@ -50,8 +50,11 @@ struct ztdeth_header { /* We take the raw message, put it in an ethernet frame, and add a two byte addressing header at the top for future use */ - +#ifdef DEFINE_SPINLOCK +static DEFINE_SPINLOCK(zlock); +#else static spinlock_t zlock = SPIN_LOCK_UNLOCKED; +#endif static struct ztdeth { unsigned char addr[ETH_ALEN]; diff --git a/ztdummy.c b/ztdummy.c index 92a41d7..185c4ac 100755 --- a/ztdummy.c +++ b/ztdummy.c @@ -152,7 +152,11 @@ int init_module(void) { #ifndef LINUX26 int irq; +#ifdef DEFINE_SPINLOCK + DEFINE_SPINLOCK(mylock); +#else spinlock_t mylock = SPIN_LOCK_UNLOCKED; +#endif if (uhci_devices==NULL){ printk ("ztdummy: Uhci_devices pointer error.\n"); diff --git a/ztdynamic.c b/ztdynamic.c index b652ae7..92045e3 100755 --- a/ztdynamic.c +++ b/ztdynamic.c @@ -126,9 +126,11 @@ static struct zt_dynamic_driver *drivers = NULL; static int debug = 0; static int hasmaster = 0; - +#ifdef DEFINE_SPINLOCK +static DEFINE_SPINLOCK(dlock); +#else static spinlock_t dlock = SPIN_LOCK_UNLOCKED; - +#endif static void checkmaster(void) { -- cgit v1.2.3