[dahdi-commits] tzafrir: branch linux/tzafrir/sysfs r5915 - in /linux/team/tzafrir/sysfs: ./ ...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Thu Jan 29 15:16:06 CST 2009


Author: tzafrir
Date: Thu Jan 29 15:16:06 2009
New Revision: 5915

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=5915
Log:
Merged revisions 5444,5453,5459-5460,5481-5486,5492,5497-5498,5503-5504,5509,5523,5534-5535,5549,5562,5568,5576,5590,5597,5604,5612,5619,5627,5635-5636 via svnmerge from 
https://origsvn.digium.com/svn/dahdi/linux/trunk

........
  r5444 | tzafrir | 2008-12-07 00:23:37 +0200 (Sun, 07 Dec 2008) | 2 lines
  
  Ignore modules.order in modules directories.
........
  r5453 | tzafrir | 2008-12-09 20:49:34 +0200 (Tue, 09 Dec 2008) | 2 lines
  
  live_dahdi - test dahdi without fully installing it.
........
  r5459 | sruffell | 2008-12-09 21:34:23 +0200 (Tue, 09 Dec 2008) | 2 lines
  
  Moving live_dahdi into the build_tools dir.
........
  r5460 | sruffell | 2008-12-09 21:37:48 +0200 (Tue, 09 Dec 2008) | 2 lines
  
  Needed to go up one more level for dahdi_tools.
........
  r5481 | sruffell | 2008-12-11 18:43:53 +0200 (Thu, 11 Dec 2008) | 3 lines
  
  wctc4xxp:  Fix compilation issues on 2.6.15 and below kernels.  Thanks
  tzafrir.
........
  r5482 | tzafrir | 2008-12-11 18:44:19 +0200 (Thu, 11 Dec 2008) | 2 lines
  
  Fixed a typo that broke building dahdi-base with kernels < 2.6.13
........
  r5483 | tzafrir | 2008-12-11 18:46:36 +0200 (Thu, 11 Dec 2008) | 2 lines
  
  A bit less maigc with OLD_HOTPLUG_SUPPORT
........
  r5484 | tzafrir | 2008-12-11 18:48:48 +0200 (Thu, 11 Dec 2008) | 2 lines
  
  Remove an include that is not available before 2.6.15 and is not needed
........
  r5485 | tzafrir | 2008-12-11 18:51:27 +0200 (Thu, 11 Dec 2008) | 2 lines
  
  Yet Another directory in which to ignore modules.order
........
  r5486 | tzafrir | 2008-12-11 18:53:18 +0200 (Thu, 11 Dec 2008) | 3 lines
  
  Fix building dahdi_dummy for kernels 2.6.13, 2.6.14:
  Those kernels don't have RTC yet.
........
  r5492 | tzafrir | 2008-12-11 20:57:14 +0200 (Thu, 11 Dec 2008) | 2 lines
  
  Fix the xpp OLD_HOTPLUG fix.
........
  r5497 | sruffell | 2008-12-11 22:19:18 +0200 (Thu, 11 Dec 2008) | 2 lines
  
  dahdi_dummy:  If we're using the system tick, don't use the hrtimer interface.
........
  r5498 | tzafrir | 2008-12-11 22:24:42 +0200 (Thu, 11 Dec 2008) | 2 lines
  
  Add a separate case for hotplug of kernels <= 2.6.9 .
........
  r5503 | tzafrir | 2008-12-11 22:51:15 +0200 (Thu, 11 Dec 2008) | 7 lines
  
  Send all samples to OSLEC, rather than just the first.
  
  (closes issue #14036)
  Reported by: marcotasto
  Patches:
        dahdi_echocan_oslec.patch uploaded by marcotasto (license 635)
........
  r5504 | tzafrir | 2008-12-11 23:03:59 +0200 (Thu, 11 Dec 2008) | 2 lines
  
  One more place whe old-but-not-ancient hotplug is used.
........
  r5509 | sruffell | 2008-12-11 23:46:09 +0200 (Thu, 11 Dec 2008) | 2 lines
  
  Add definition of dev_notice for kernels < 2.6.17.
........
  r5523 | kpfleming | 2008-12-12 16:32:10 +0200 (Fri, 12 Dec 2008) | 1 line
  
  use a format string for request_module, so the compiler will do the right thing
........
  r5534 | sruffell | 2008-12-15 22:30:26 +0200 (Mon, 15 Dec 2008) | 2 lines
  
  wcte12xp: do not release a spinlock that we did not acquire.
........
  r5535 | sruffell | 2008-12-15 22:31:27 +0200 (Mon, 15 Dec 2008) | 2 lines
  
  live_dahdi: Use the nonrelative path for the dahdi-tools folder in live_dahdi.
........
  r5549 | sruffell | 2008-12-16 18:35:43 +0200 (Tue, 16 Dec 2008) | 2 lines
  
  wcte12xp: Quiet some warnings about possible use of uninitialized variables.
........
  r5562 | sruffell | 2008-12-17 05:01:55 +0200 (Wed, 17 Dec 2008) | 2 lines
  
  wcb4xxp: Remove an endless while loop.
........
  r5568 | sruffell | 2008-12-17 06:39:26 +0200 (Wed, 17 Dec 2008) | 2 lines
  
  wcb4xxp: Use %p to print out pointer values.
........
  r5576 | sruffell | 2008-12-17 17:57:56 +0200 (Wed, 17 Dec 2008) | 3 lines
  
  wcb4xxp: Do not propogate received HDLC frames on channels that are not
  configured.  Issue: DAHDI-217
........
  r5590 | tzafrir | 2008-12-19 14:39:31 +0200 (Fri, 19 Dec 2008) | 4 lines
  
  Fix the safety check in tor2 to be for SPANS_PER_CARD
  
  Thanks to Eugene Teo, in a from issue #13954 .
........
  r5597 | mattf | 2008-12-19 23:14:00 +0200 (Fri, 19 Dec 2008) | 1 line
  
  Add support for new half full buffer policy.  This significantly improves performance in fax and data modem calls.
........
  r5604 | mattf | 2008-12-19 23:48:00 +0200 (Fri, 19 Dec 2008) | 1 line
  
  Revert MAX_NUM_BUFS back to 32
........
  r5612 | sruffell | 2008-12-23 06:02:13 +0200 (Tue, 23 Dec 2008) | 3 lines
  
  Enabling a module parameter that will allow the user to periodically print the
  battery voltage to the kernel log.  Used for troubleshooting.  Issue: DAHDI-34
........
  r5619 | seanbright | 2008-12-30 00:52:32 +0200 (Tue, 30 Dec 2008) | 1 line
  
  Don't echo the echo.  Echo.
........
  r5627 | sruffell | 2009-01-05 21:21:24 +0200 (Mon, 05 Jan 2009) | 3 lines
  
  Print more information to the kernel log when the transcoder sends us a
  diagnostic message.
........
  r5635 | sruffell | 2009-01-06 00:32:07 +0200 (Tue, 06 Jan 2009) | 5 lines
  
  spin_is_lock always evalulates to 0 on SMP kernels.  So since I still want to
  keep the check in there to avoid problems in the future (and since this code
  path is only used when opening a new transcoder session) I made the check
  conditional on running an SMP kernel.
........
  r5636 | sruffell | 2009-01-06 00:49:18 +0200 (Tue, 06 Jan 2009) | 2 lines
  
  Even on older kernels, do not redefine WARN_ON_ONCE if it is already defined.
........

Modified:
    linux/team/tzafrir/sysfs/   (props changed)
    linux/team/tzafrir/sysfs/drivers/dahdi/Kbuild
    linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-base.c
    linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dummy.c
    linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dynamic.c
    linux/team/tzafrir/sysfs/drivers/dahdi/tor2.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wcb4xxp/Kbuild
    linux/team/tzafrir/sysfs/drivers/dahdi/wcb4xxp/base.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wct1xxp.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wct4xxp/Kbuild
    linux/team/tzafrir/sysfs/drivers/dahdi/wct4xxp/base.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wctc4xxp/Kbuild
    linux/team/tzafrir/sysfs/drivers/dahdi/wctc4xxp/base.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wctdm.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wctdm24xxp/Kbuild
    linux/team/tzafrir/sysfs/drivers/dahdi/wctdm24xxp/base.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
    linux/team/tzafrir/sysfs/drivers/dahdi/wcte11xp.c
    linux/team/tzafrir/sysfs/drivers/dahdi/wcte12xp/Kbuild
    linux/team/tzafrir/sysfs/drivers/dahdi/wcte12xp/base.c
    linux/team/tzafrir/sysfs/include/dahdi/kernel.h
    linux/team/tzafrir/sysfs/include/dahdi/user.h

Propchange: linux/team/tzafrir/sysfs/
------------------------------------------------------------------------------
    automerge = *

Propchange: linux/team/tzafrir/sysfs/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jan 29 15:16:06 2009
@@ -1,1 +1,1 @@
-/linux/trunk:1-5765
+/linux/trunk:1-5914

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/Kbuild
URL: http://svn.digium.com/svn-view/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/Kbuild?view=diff&rev=5915&r1=5914&r2=5915
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/Kbuild (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/Kbuild Thu Jan 29 15:16:06 2009
@@ -56,6 +56,12 @@
 EXTRA_CFLAGS+=-Drw_lock_t=rwlock_t
 endif
 
+# A number of Fedora 10 (9 also?) kernels backported hrtimer to 2.6.27
+# as part of an ALSA backport. TODO: Any better way to detect that?
+ifeq (1,$(shell fgrep -q ' hrtimer_set_expires' include/linux/hrtimer.h 2>/dev/null && echo 1))
+EXTRA_CFLAGS+=-DHAVE_HRTIMER_ACCESSORS=1
+endif
+
 dahdi-objs := dahdi-base.o dahdi-sysfs.o dahdi-sysfs-chan.o
 
 dahdi_echocan_hpec-objs := hpec/dahdi_echocan_hpec.o

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-base.c?view=diff&rev=5915&r1=5914&r2=5915
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-base.c Thu Jan 29 15:16:06 2009
@@ -1163,6 +1163,14 @@
 #endif
 }
 
+/** 
+ * close_channel - close the channel, resetting any channel variables
+ * @chan: the dahdi_chan to close
+ *
+ * This function might be called before the channel is placed on the global
+ * array of channels, (chans), and therefore, neither this function nor it's
+ * children should depend on the dahdi_chan.channo member which is not set yet.
+ */
 static void close_channel(struct dahdi_chan *chan)
 {
 	unsigned long flags;
@@ -1480,43 +1488,43 @@
 static int dahdi_chan_reg(struct dahdi_chan *chan)
 {
 	int x;
-	int res = 0;
 	unsigned long flags;
 
 	might_sleep();
+
+	spin_lock_init(&chan->lock);
+	if (!chan->master)
+		chan->master = chan;
+	if (!chan->readchunk)
+		chan->readchunk = chan->sreadchunk;
+	if (!chan->writechunk)
+		chan->writechunk = chan->swritechunk;
+	dahdi_set_law(chan, 0);
+	close_channel(chan);
 
 	write_lock_irqsave(&chan_lock, flags);
 	for (x = 1; x < DAHDI_MAX_CHANNELS; x++) {
 		if (chans[x])
 			continue;
 
-		spin_lock_init(&chan->lock);
 		chans[x] = chan;
 		if (maxchans < x + 1)
 			maxchans = x + 1;
 		chan->channo = x;
-		if (!chan->master)
-			chan->master = chan;
-		if (!chan->readchunk)
-			chan->readchunk = chan->sreadchunk;
-		if (!chan->writechunk)
-			chan->writechunk = chan->swritechunk;
 		write_unlock_irqrestore(&chan_lock, flags);
-		dahdi_set_law(chan, 0);
-		close_channel(chan);
 		/* set this AFTER running close_channel() so that
 		   HDLC channels wont cause hangage */
-		chan->flags |= DAHDI_FLAG_REGISTERED;
-		res = 0;
+		set_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags);
 		break;
 	}
 
 	if (DAHDI_MAX_CHANNELS == x) {
 		write_unlock_irqrestore(&chan_lock, flags);
 		module_printk(KERN_ERR, "No more channels available\n");
-	}
-
-	return res;
+		return -ENOMEM;
+	}
+
+	return 0;
 }
 
 char *dahdi_lboname(int x)
@@ -1879,9 +1887,9 @@
 	}
 #endif
 	write_lock_irqsave(&chan_lock, flags);
-	if (chan->flags & DAHDI_FLAG_REGISTERED) {
+	if (test_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags)) {
 		chans[chan->channo] = NULL;
-		chan->flags &= ~DAHDI_FLAG_REGISTERED;
+		clear_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags);
 	}
 #ifdef CONFIG_DAHDI_PPP
 	if (chan->ppp) {
@@ -2408,7 +2416,7 @@
 	}
 
 	/* if not registered yet, just return here */
-	if (!(chan->flags & DAHDI_FLAG_REGISTERED))
+	if (!test_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags))
 		return res;
 
 	/* Mark all buffers as empty */
@@ -4317,7 +4325,7 @@
 		struct dahdi_confinfo conf;
 		struct dahdi_ring_cadence cad;
 	} stack;
-	unsigned long flags, flagso;
+	unsigned long flags;
 	int i, j, k, rv;
 	int ret, c;
 
@@ -4567,14 +4575,14 @@
 		  /* likewise if 0 mode must have no conf */
 		if ((!stack.conf.confmode) && stack.conf.confno) return (-EINVAL);
 		stack.conf.chan = i;  /* return with real channel # */
-		spin_lock_irqsave(&bigzaplock, flagso);
-		spin_lock_irqsave(&chan->lock, flags);
+		spin_lock_irqsave(&bigzaplock, flags);
+		spin_lock(&chan->lock);
 		if (stack.conf.confno == -1)
 			stack.conf.confno = dahdi_first_empty_conference();
 		if ((stack.conf.confno < 1) && (stack.conf.confmode)) {
 			/* No more empty conferences */
-			spin_unlock_irqrestore(&chan->lock, flags);
-			spin_unlock_irqrestore(&bigzaplock, flagso);
+			spin_unlock(&chan->lock);
+			spin_unlock_irqrestore(&bigzaplock, flags);
 			return -EBUSY;
 		}
 		  /* if changing confs, clear last added info */
@@ -4626,8 +4634,8 @@
 			}
 		}
 
-		spin_unlock_irqrestore(&chan->lock, flags);
-		spin_unlock_irqrestore(&bigzaplock, flagso);
+		spin_unlock(&chan->lock);
+		spin_unlock_irqrestore(&bigzaplock, flags);
 		if (copy_to_user((struct dahdi_confinfo *) data,&stack.conf,sizeof(stack.conf)))
 			return -EFAULT;
 		break;
@@ -4640,16 +4648,16 @@
 		if ((stack.conf.confno < 0) || (stack.conf.confno > DAHDI_MAX_CONF)) return(-EINVAL);
 		  /* cant listen to self!! */
 		if (stack.conf.chan && (stack.conf.chan == stack.conf.confno)) return(-EINVAL);
-		spin_lock_irqsave(&bigzaplock, flagso);
-		spin_lock_irqsave(&chan->lock, flags);
+		spin_lock_irqsave(&bigzaplock, flags);
+		spin_lock(&chan->lock);
 		  /* if to clear all links */
 		if ((!stack.conf.chan) && (!stack.conf.confno))
 		   {
 			   /* clear all the links */
 			memset(conf_links,0,sizeof(conf_links));
 			recalc_maxlinks();
-			spin_unlock_irqrestore(&chan->lock, flags);
-			spin_unlock_irqrestore(&bigzaplock, flagso);
+			spin_unlock(&chan->lock);
+			spin_unlock_irqrestore(&bigzaplock, flags);
 			break;
 		   }
 		rv = 0;  /* clear return value */
@@ -4699,8 +4707,8 @@
 			   }
 		   }
 		recalc_maxlinks();
-		spin_unlock_irqrestore(&chan->lock, flags);
-		spin_unlock_irqrestore(&bigzaplock, flagso);
+		spin_unlock(&chan->lock);
+		spin_unlock_irqrestore(&bigzaplock, flags);
 		return(rv);
 	case DAHDI_CONFDIAG:  /* output diagnostic info to console */
 		if (!(chan->flags & DAHDI_FLAG_AUDIO)) return (-EINVAL);
@@ -5407,7 +5415,7 @@
 	if (!span)
 		return -EINVAL;
 
-	if (span->flags & DAHDI_FLAG_REGISTERED) {
+	if (test_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags)) {
 		module_printk(KERN_ERR, "Span %s already appears to be registered\n", span->name);
 		return -EBUSY;
 	}
@@ -5433,7 +5441,7 @@
 		return -EBUSY;
 	}
 
-	span->flags |= DAHDI_FLAG_REGISTERED;
+	set_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags);
 	span->spanno = x;
 
 	spin_lock_init(&span->lock);
@@ -5516,7 +5524,7 @@
 	char tempfile[17];
 #endif /* CONFIG_PROC_FS */
 
-	if (!(span->flags & DAHDI_FLAG_REGISTERED)) {
+	if (!test_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags)) {
 		module_printk(KERN_ERR, "Span %s does not appear to be registered\n", span->name);
 		return -1;
 	}
@@ -5543,7 +5551,7 @@
 
 	spans[span->spanno] = NULL;
 	span->spanno = 0;
-	span->flags &= ~DAHDI_FLAG_REGISTERED;
+	clear_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags);
 	for (x=0;x<span->channels;x++)
 		dahdi_chan_unreg(span->chans[x]);
 	span_sysfs_remove(span);
@@ -7678,7 +7686,7 @@
 int dahdi_receive(struct dahdi_span *span)
 {
 	int x,y,z;
-	unsigned long flags, flagso;
+	unsigned long flags;
 
 #if 1
 #ifdef CONFIG_DAHDI_WATCHDOG
@@ -7763,7 +7771,8 @@
 	if (span == master) {
 		/* Hold the big zap lock for the duration of major
 		   activities which touch all sorts of channels */
-		spin_lock_irqsave(&bigzaplock, flagso);
+		spin_lock_irqsave(&bigzaplock, flags);
+		read_lock(&chan_lock);
 		/* Process any timers */
 		process_timers();
 		/* If we have dynamic stuff, call the ioctl with 0,0 parameters to
@@ -7773,12 +7782,12 @@
 		for (x=1;x<maxchans;x++) {
 			if (chans[x] && chans[x]->confmode && !(chans[x]->flags & DAHDI_FLAG_PSEUDO)) {
 				u_char *data;
-				spin_lock_irqsave(&chans[x]->lock, flags);
+				spin_lock(&chans[x]->lock);
 				data = __buf_peek(&chans[x]->confin);
 				__dahdi_receive_chunk(chans[x], data);
 				if (data)
 					__buf_pull(&chans[x]->confin, NULL,chans[x], "confreceive");
-				spin_unlock_irqrestore(&chans[x]->lock, flags);
+				spin_unlock(&chans[x]->lock);
 			}
 		}
 		/* This is the master channel, so make things switch over */
@@ -7786,9 +7795,9 @@
 		/* do all the pseudo and/or conferenced channel receives (getbuf's) */
 		for (x=1;x<maxchans;x++) {
 			if (chans[x] && (chans[x]->flags & DAHDI_FLAG_PSEUDO)) {
-				spin_lock_irqsave(&chans[x]->lock, flags);
+				spin_lock(&chans[x]->lock);
 				__dahdi_transmit_chunk(chans[x], NULL);
-				spin_unlock_irqrestore(&chans[x]->lock, flags);
+				spin_unlock(&chans[x]->lock);
 			}
 		}
 		if (maxlinks) {
@@ -7811,21 +7820,21 @@
 		for (x=1;x<maxchans;x++) {
 			if (chans[x] && (chans[x]->flags & DAHDI_FLAG_PSEUDO)) {
 				unsigned char tmp[DAHDI_CHUNKSIZE];
-				spin_lock_irqsave(&chans[x]->lock, flags);
+				spin_lock(&chans[x]->lock);
 				__dahdi_getempty(chans[x], tmp);
 				__dahdi_receive_chunk(chans[x], tmp);
-				spin_unlock_irqrestore(&chans[x]->lock, flags);
+				spin_unlock(&chans[x]->lock);
 			}
 		}
 		for (x=1;x<maxchans;x++) {
 			if (chans[x] && chans[x]->confmode && !(chans[x]->flags & DAHDI_FLAG_PSEUDO)) {
 				u_char *data;
-				spin_lock_irqsave(&chans[x]->lock, flags);
+				spin_lock(&chans[x]->lock);
 				data = __buf_pushpeek(&chans[x]->confout);
 				__dahdi_transmit_chunk(chans[x], data);
 				if (data)
 					__buf_push(&chans[x]->confout, NULL, "conftransmit");
-				spin_unlock_irqrestore(&chans[x]->lock, flags);
+				spin_unlock(&chans[x]->lock);
 			}
 		}
 #ifdef	DAHDI_SYNC_TICK
@@ -7836,7 +7845,8 @@
 				s->sync_tick(s, s == master);
 		}
 #endif
-		spin_unlock_irqrestore(&bigzaplock, flagso);
+		read_unlock(&chan_lock);
+		spin_unlock_irqrestore(&bigzaplock, flags);
 	}
 #endif
 	return 0;

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dummy.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dummy.c?view=diff&rev=5915&r1=5914&r2=5915
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dummy.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dummy.c Thu Jan 29 15:16:06 2009
@@ -89,8 +89,10 @@
 #define USB2420
 #endif
 
-#if defined(USE_HIGHRESTIMER) && ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) )
-/* compatibility with new hrtimer interface */
+#ifndef HAVE_HRTIMER_ACCESSORS
+#if defined(USE_HIGHRESTIMER) && \
+	(LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28))
+/* Compatibility with new hrtimer interface */
 static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer)
 {
 	return timer->expires;
@@ -100,6 +102,7 @@
 {
 	timer->expires = time;
 }
+#endif
 #endif
 
 struct dahdi_dummy {

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dynamic.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dynamic.c?view=diff&rev=5915&r1=5914&r2=5915
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dynamic.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi_dynamic.c Thu Jan 29 15:16:06 2009
@@ -414,7 +414,7 @@
 	unsigned int x;
 
 	/* Unregister span if appropriate */
-	if (z->span.flags & DAHDI_FLAG_REGISTERED)
+	if (test_bit(DAHDI_FLAGBIT_REGISTERED, &z->span.flags))
 		dahdi_unregister(&z->span);
 
 	/* Destroy the pvt stuff if there */

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/tor2.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/tor2.c?view=diff&rev=5915&r1=5914&r2=5915
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/tor2.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/tor2.c Thu Jan 29 15:16:06 2009
@@ -314,7 +314,7 @@
 
 static int __devinit tor2_launch(struct tor2 *tor)
 {
-	if (tor->spans[0].flags & DAHDI_FLAG_REGISTERED)
+	if (test_bit(DAHDI_FLAGBIT_REGISTERED, &tor->spans[0].flags))
 		return 0;
 	printk(KERN_INFO "Tor2: Launching card: %d\n", tor->order);
 	if (dahdi_register(&tor->spans[0], 0)) {
@@ -618,6 +618,7 @@
 static void __devexit tor2_remove(struct pci_dev *pdev)
 {
 	struct tor2 *tor;
+	int i;
 
 	tor = pci_get_drvdata(pdev);
 	if (!tor)
@@ -627,14 +628,10 @@
 	tor->mem8[LEDREG] = 0;
 	tor->plx[INTCSR] = cpu_to_le16(0);
 	free_irq(tor->irq, tor);
-	if (tor->spans[0].flags & DAHDI_FLAG_REGISTERED)
-		dahdi_unregister(&tor->spans[0]);
-	if (tor->spans[1].flags & DAHDI_FLAG_REGISTERED)
-		dahdi_unregister(&tor->spans[1]);
-	if (tor->spans[2].flags & DAHDI_FLAG_REGISTERED)
-		dahdi_unregister(&tor->spans[2]);
-	if (tor->spans[3].flags & DAHDI_FLAG_REGISTERED)
-		dahdi_unregister(&tor->spans[3]);
+	for (i = 0; i < SPANS_PER_CARD; ++i) {
+		if (test_bit(DAHDI_FLAGBIT_REGISTERED, &tor->spans[i].flags))
+			dahdi_unregister(&tor->spans[i]);
+	}
 	release_mem_region(tor->plx_region, tor->plx_len);
 	release_mem_region(tor->xilinx32_region, tor->xilinx32_len);
 	release_mem_region(tor->xilinx8_region, tor->xilinx8_len);

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/wcb4xxp/Kbuild
URL: http://svn.digium.com/svn-view/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/wcb4xxp/Kbuild?view=diff&rev=5915&r1=5914&r2=5915
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/wcb4xxp/Kbuild (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/wcb4xxp/Kbuild Thu Jan 29 15:16:06 2009
@@ -1,6 +1,6 @@
 obj-m += wcb4xxp.o
 
-EXTRA_CFLAGS := -I$(src)/.. -Wno-undef
+EXTRA_CFLAGS += -I$(src)/.. -Wno-undef
 
 wcb4xxp-objs := base.o
 

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/wcb4xxp/base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/wcb4xxp/base.c?view=diff&rev=5915&r1=5914&r2=5915
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/wcb4xxp/base.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/wcb4xxp/base.c Thu Jan 29 15:16:06 2009
@@ -2700,6 +2700,7 @@
 #endif
 module_param(milliwatt, int, S_IRUGO | S_IWUSR);
 module_param(pedanticpci, int, S_IRUGO);
+module_param(teignorered, int, S_IRUGO | S_IWUSR);
 module_param(alarmdebounce, int, S_IRUGO | S_IWUSR);
 module_param(vpmsupport, int, S_IRUGO);
 module_param(timer_1_ms, int, S_IRUGO | S_IWUSR);

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/wct1xxp.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/wct1xxp.c?view=diff&rev=5915&r1=5914&r2=5915
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/wct1xxp.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/wct1xxp.c Thu Jan 29 15:16:06 2009
@@ -624,7 +624,7 @@
 		t1xxp_e1_framer_start(wc);
 	else
 		t1xxp_t1_framer_start(wc);
-	printk(KERN_INFO "Calling startup (flags is %d)\n", span->flags);
+	printk(KERN_INFO "Calling startup (flags is %lu)\n", span->flags);
 
 	if (!alreadyrunning) {
 		/* Only if we're not already going */

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/wct4xxp/Kbuild
URL: http://svn.digium.com/svn-view/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/wct4xxp/Kbuild?view=diff&rev=5915&r1=5914&r2=5915
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/wct4xxp/Kbuild (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/wct4xxp/Kbuild Thu Jan 29 15:16:06 2009
@@ -2,7 +2,7 @@
 
 FIRM_DIR	:= ../firmware
 
-EXTRA_CFLAGS := -I$(src)/.. $(shell $(src)/../oct612x/octasic-helper cflags $(src)/../oct612x) -Wno-undef
+EXTRA_CFLAGS += -I$(src)/.. $(shell $(src)/../oct612x/octasic-helper cflags $(src)/../oct612x) -Wno-undef
 
 ifeq ($(HOTPLUG_FIRMWARE),yes)
   EXTRA_CFLAGS+=-DHOTPLUG_FIRMWARE

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/wct4xxp/base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/wct4xxp/base.c?view=diff&rev=5915&r1=5914&r2=5915
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/wct4xxp/base.c Thu Jan 29 15:16:06 2009
@@ -3441,7 +3441,7 @@
 {
 	int x;
 	unsigned long flags;
-	if (wc->tspans[0]->span.flags & DAHDI_FLAG_REGISTERED)
+	if (test_bit(DAHDI_FLAGBIT_REGISTERED, &wc->tspans[0]->span.flags))
 		return 0;
 	printk(KERN_INFO "TE%dXXP: Launching card: %d\n", wc->numspans, wc->order);
 
@@ -3726,6 +3726,8 @@
 static void __devexit t4_remove_one(struct pci_dev *pdev)
 {
 	struct t4 *wc = pci_get_drvdata(pdev);
+	struct dahdi_span *span;
+	int i;
 
 	if (!wc) {
 		return;
@@ -3739,15 +3741,11 @@
 		release_vpm450m(wc->vpm450m);
 	wc->vpm450m = NULL;
 	/* Unregister spans */
-	if (wc->tspans[0]->span.flags & DAHDI_FLAG_REGISTERED)
-		dahdi_unregister(&wc->tspans[0]->span);
-	if (wc->tspans[1]->span.flags & DAHDI_FLAG_REGISTERED)
-		dahdi_unregister(&wc->tspans[1]->span);
-	if (wc->numspans == 4) {
-		if (wc->tspans[2]->span.flags & DAHDI_FLAG_REGISTERED)
-			dahdi_unregister(&wc->tspans[2]->span);
-		if (wc->tspans[3]->span.flags & DAHDI_FLAG_REGISTERED)
-			dahdi_unregister(&wc->tspans[3]->span);
+
+	for (i = 0; i < wc->numspans; ++i) {
+		span = &wc->tspans[i]->span;
+		if (test_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags))
+			dahdi_unregister(span);
 	}
 #ifdef ENABLE_WORKQUEUES
 	if (wc->workq) {

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/wctc4xxp/Kbuild
URL: http://svn.digium.com/svn-view/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/wctc4xxp/Kbuild?view=diff&rev=5915&r1=5914&r2=5915
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/wctc4xxp/Kbuild (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/wctc4xxp/Kbuild Thu Jan 29 15:16:06 2009
@@ -2,7 +2,7 @@
 
 FIRM_DIR	:= ../firmware
 
-EXTRA_CFLAGS := -I$(src)/.. -Wno-undef
+EXTRA_CFLAGS += -I$(src)/.. -Wno-undef
 
 ifeq ($(HOTPLUG_FIRMWARE),yes)
   EXTRA_CFLAGS+=-DHOTPLUG_FIRMWARE

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/wctc4xxp/base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/wctc4xxp/base.c?view=diff&rev=5915&r1=5914&r2=5915
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/wctc4xxp/base.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/wctc4xxp/base.c Thu Jan 29 15:16:06 2009
@@ -459,10 +459,12 @@
 	unsigned long flags;
 
 	spinlock_t cmd_list_lock;
+	spinlock_t rx_list_lock;
 	/* This is a device-global list of commands that are waiting to be
 	 * transmited (and did not fit on the transmit descriptor ring) */
 	struct list_head cmd_list;
 	struct list_head waiting_for_response_list;
+	struct list_head rx_list;
 
 	unsigned int seq_num;
 	unsigned char numchannels;
@@ -500,6 +502,25 @@
 	struct timer_list watchdog;
 
 };
+
+#ifdef HAVE_NETDEV_PRIV
+struct wcdte_netdev_priv {
+	struct wcdte *wc;
+};
+#endif
+
+static inline struct wcdte *
+wcdte_from_netdev(struct net_device *netdev)
+{
+#ifdef HAVE_NETDEV_PRIV
+	struct wcdte_netdev_priv *priv;
+	priv = netdev_priv(netdev);
+	return priv->wc;
+#else
+	return netdev->priv;
+#endif
+}
+
 
 static inline void wctc4xxp_set_ready(struct wcdte *wc) {
 	set_bit(DTE_READY, &wc->flags);
@@ -566,7 +587,6 @@
 	return pt;
 }
 
-
 static struct sk_buff * 
 tcb_to_skb(struct net_device *netdev, const struct tcb *cmd)
 {
@@ -616,7 +636,7 @@
 static void 
 wctc4xxp_net_set_multi(struct net_device *netdev)
 {
-	struct wcdte *wc = netdev->priv;
+	struct wcdte *wc = wcdte_from_netdev(netdev);
 	DTE_DEBUG(DTE_DEBUG_GENERAL, "%s promiscuity:%d\n", 
 	   __FUNCTION__, netdev->promiscuity);
 }
@@ -624,7 +644,7 @@
 static int 
 wctc4xxp_net_up(struct net_device *netdev)
 {
-	struct wcdte *wc = netdev->priv;
+	struct wcdte *wc = wcdte_from_netdev(netdev);
 	DTE_DEBUG(DTE_DEBUG_GENERAL, "%s\n", __FUNCTION__);
 #if 1
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
@@ -639,7 +659,7 @@
 static int 
 wctc4xxp_net_down(struct net_device *netdev)
 {
-	struct wcdte *wc = netdev->priv;
+	struct wcdte *wc = wcdte_from_netdev(netdev);
 	DTE_DEBUG(DTE_DEBUG_GENERAL, "%s\n", __FUNCTION__);
 #if 1
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
@@ -656,7 +676,7 @@
 static int 
 wctc4xxp_net_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev)
 {
-	struct wcdte *wc = netdev->priv;
+	struct wcdte *wc = wcdte_from_netdev(netdev);
 	struct tcb *cmd;
 
 	/* We set DO_NOT_CAPTURE because this packet was already captured by
@@ -691,7 +711,7 @@
 static int 
 wctc4xxp_poll(struct net_device *netdev, int *budget)
 {
-	struct wcdte *wc = netdev->priv;
+	struct wcdte *wc = wcdte_from_netdev(netdev);
 	int count = 0;
 	int quota = min(netdev->quota, *budget);
 
@@ -717,7 +737,11 @@
 	count = wctc4xxp_net_receive(wc, budget);
 
 	if (!skb_queue_len(&wc->captured_packets)) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
 		netif_rx_complete(wc->netdev, &wc->napi);
+#else
+		netif_rx_complete(&wc->napi);
+#endif
 	}
 	return count;
 }
@@ -726,7 +750,7 @@
 static struct net_device_stats *
 wctc4xxp_net_get_stats(struct net_device *netdev)
 {
-	struct wcdte *wc = netdev->priv;
+	struct wcdte *wc = wcdte_from_netdev(netdev);
 	return &wc->net_stats;
 }
 
@@ -763,7 +787,7 @@
 static int 
 wctc4xxp_net_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
 {
-	struct wcdte *wc = netdev->priv;
+	struct wcdte *wc = wcdte_from_netdev(netdev);
 	switch(cmd) {
 	case 0x89f0:
 		down(&wc->chansem);
@@ -792,14 +816,24 @@
 {
 	int res;
 	struct net_device *netdev;
+#	ifdef HAVE_NETDEV_PRIV
+	struct wcdte_netdev_priv *priv;
+#	endif
 	const char our_mac[] = { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
 
-	if (!(netdev = alloc_netdev(0, wc->board_name, ether_setup))) {
+#	ifdef HAVE_NETDEV_PRIV
+	netdev = alloc_netdev(sizeof(*priv), wc->board_name, ether_setup);
+	if (!netdev)
 		return -ENOMEM;
-	}
-
+	priv = netdev_priv(netdev);
+	priv->wc = wc;
+#	else
+	netdev = alloc_netdev(0, wc->board_name, ether_setup);
+	if (!netdev)
+		return -ENOMEM;
+	netdev->priv = wc;
+#	endif
 	memcpy(netdev->dev_addr, our_mac, sizeof(our_mac));
-	netdev->priv = wc;
 	netdev->set_multicast_list = &wctc4xxp_net_set_multi;
 	netdev->open = &wctc4xxp_net_up;
 	netdev->stop = &wctc4xxp_net_down;
@@ -888,10 +922,12 @@
 	}
 
 	skb_queue_tail(&wc->captured_packets, skb);
-#	if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
+#	if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
 	netif_rx_schedule(netdev);
+#	elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
+	netif_rx_schedule(netdev, &wc->napi);
 #	else
-	netif_rx_schedule(netdev, &wc->napi);
+	netif_rx_schedule(&wc->napi);
 #	endif
 	return;
 }
@@ -1008,6 +1044,7 @@
 {
 	volatile struct wctc4xxp_descriptor *d;
 	unsigned int len;
+	unsigned long flags;
 
 	WARN_ON(!c);
 	len = (c->data_len < MIN_PACKET_LEN) ? MIN_PACKET_LEN : c->data_len;
@@ -1016,11 +1053,11 @@
 		c->data_len = MAX_FRAME_SIZE;
 	}
 
-	spin_lock_bh(&dr->lock);
+	spin_lock_irqsave(&dr->lock, flags);
 	d = wctc4xxp_descriptor(dr, dr->tail); 
 	WARN_ON(!d);
 	if (d->buffer1) {
-		spin_unlock_bh(&dr->lock);
+		spin_unlock_irqrestore(&dr->lock, flags);
 		/* Do not overwrite a buffer that is still in progress. */
 		return -EBUSY;
 	}
@@ -1033,7 +1070,7 @@
 	dr->pending[dr->tail] = c;
 	dr->tail = ++dr->tail & DRING_MASK;
 	++dr->count;
-	spin_unlock_bh(&dr->lock);
+	spin_unlock_irqrestore(&dr->lock, flags);
 	return 0;
 }
 
@@ -1043,7 +1080,8 @@
 	volatile struct wctc4xxp_descriptor *d;
 	struct tcb *c;
 	unsigned int head = dr->head;
-	spin_lock_bh(&dr->lock);
+	unsigned long flags;
+	spin_lock_irqsave(&dr->lock, flags);
 	d = wctc4xxp_descriptor(dr, head);
 	if (d->buffer1 && !OWNED(d)) {
 		pci_unmap_single(dr->pdev, d->buffer1, 
@@ -1059,16 +1097,17 @@
 	} else {
 		c = NULL;
 	}
-	spin_unlock_bh(&dr->lock);
+	spin_unlock_irqrestore(&dr->lock, flags);
 	return c;
 }
 
 static inline int wctc4xxp_getcount(struct wctc4xxp_descriptor_ring *dr) 
 {
 	int count;
-	spin_lock_bh(&dr->lock);
+	unsigned long flags;
+	spin_lock_irqsave(&dr->lock, flags);
 	count = dr->count;
-	spin_unlock_bh(&dr->lock);
+	spin_unlock_irqrestore(&dr->lock, flags);
 	return count;
 }
 
@@ -1259,9 +1298,10 @@
 {
 	int i; 
 	struct wctc4xxp_descriptor *d;
+	unsigned long flags;
 	
 	/* NOTE: The DTE must be in the stopped state. */
-	spin_lock_bh(&dr->lock);
+	spin_lock_irqsave(&dr->lock, flags);
 	for (i = 0; i < DRING_SIZE; ++i) {
 		d = wctc4xxp_descriptor(dr, i);
 		if (d->buffer1) {
@@ -1279,7 +1319,7 @@
 	dr->head = 0;
 	dr->tail = 0;
 	dr->count = 0;
-	spin_unlock_bh(&dr->lock);
+	spin_unlock_irqrestore(&dr->lock, flags);
 	pci_free_consistent(dr->pdev, (sizeof(*d)+dr->padding) * DRING_SIZE, 
 	                    dr->desc, dr->desc_dma); 
 }
@@ -1292,9 +1332,10 @@
 	spin_lock_bh(&wc->cmd_list_lock);
 	list_splice_init(&wc->cmd_list, &local_list);
 	list_splice_init(&wc->waiting_for_response_list, &local_list);
+	list_splice_init(&wc->rx_list, &local_list);
 	spin_unlock_bh(&wc->cmd_list_lock);
 
-	while(!list_empty(&local_list)) {
+	while (!list_empty(&local_list)) {
 		cmd = list_entry(local_list.next, struct tcb, node); 
 		list_del_init(&cmd->node);
 		free_cmd(cmd);
@@ -1500,9 +1541,7 @@
 	u8 wctc4xxp_dstfmt; /* Digium Transcoder Engine Dest Format */
 	int res;
 
-	if (down_interruptible(&wc->chansem)) {
-		return -EINTR;
-	}
+	down(&wc->chansem);
 
 	/* Check again to see if the channel was built after grabbing the
 	 * channel semaphore, in case the previous holder of the semaphore
@@ -1581,9 +1620,7 @@
 		return -EIO;
 	}
 
-	if (down_interruptible(&wc->chansem)) {
-		return -EINTR;
-	}
+	down(&wc->chansem);
 
 	/* Remove any packets that are waiting on the outbound queue. */
 	wctc4xxp_cleanup_channel_private(wc, dtc);
@@ -2065,28 +2102,21 @@
 static inline void service_rx_ring(struct wcdte *wc)
 {
 	struct tcb *cmd;
-	while ((cmd = wctc4xxp_retrieve(wc->rxd))) {
-		struct tcb *newcmd;
+	unsigned long flags;
+	LIST_HEAD(local_list);
+
+	spin_lock_irqsave(&wc->rx_list_lock, flags);
+	list_splice_init(&wc->rx_list, &local_list);
+	spin_unlock_irqrestore(&wc->rx_list_lock, flags);
+
+	/*
+	 * Process the received packets
+	 */
+	while (!list_empty(&local_list)) {
+		cmd = container_of(local_list.next, struct tcb, node);
+		list_del_init(&cmd->node);
 
 		wctc4xxp_net_capture_cmd(wc, cmd);
-
-		if(!(newcmd = __alloc_cmd(ALLOC_FLAGS, 0))) {
-			DTE_PRINTK(ERR, "Out of memory in %s.\n", __FUNCTION__);
-		} else {
-			if (newcmd->data_len < MAX_FRAME_SIZE) {
-				newcmd->data = kmalloc(MAX_FRAME_SIZE, ALLOC_FLAGS);
-				if (!newcmd->data) {
-					DTE_PRINTK(ERR, "out of memory in %s " \
-					    "again.\n", __FUNCTION__);
-				}
-				newcmd->data_len = MAX_FRAME_SIZE;
-			}
-			if (wctc4xxp_submit(wc->rxd, newcmd)) {
-				DTE_PRINTK(ERR, "Failed submit in %s\n", __FUNCTION__);
-				free_cmd(newcmd);
-			}
-			wctc4xxp_receive_demand_poll(wc);
-		}
 		wctc4xxp_receiveprep(wc, cmd);
 	}
 	wctc4xxp_receive_demand_poll(wc);
@@ -2114,6 +2144,7 @@
 DAHDI_IRQ_HANDLER(wctc4xxp_interrupt)
 {
 	struct wcdte *wc = dev_id;
+	struct tcb *cmd;
 	u32 ints;
 	u32 reg;
 #define TX_COMPLETE_INTERRUPT 0x00000001
@@ -2130,10 +2161,28 @@
 
 	if (likely(ints & NORMAL_INTERRUPTS)) {
 		reg = 0;
-		if (ints & TX_COMPLETE_INTERRUPT) {
+		if (ints & TX_COMPLETE_INTERRUPT)
 			reg |= TX_COMPLETE_INTERRUPT;
-		}
+
 		if (ints & RX_COMPLETE_INTERRUPT) {
+			while ((cmd = wctc4xxp_retrieve(wc->rxd))) {
+				spin_lock(&wc->rx_list_lock);
+				list_add_tail(&cmd->node, &wc->rx_list);
+				spin_unlock(&wc->rx_list_lock);
+
+				cmd = __alloc_cmd(GFP_ATOMIC, 0);
+				if (!cmd) {
+					DTE_PRINTK(ERR,
+					  "Out of memory in %s.\n", __func__);
+				} else {
+					if (wctc4xxp_submit(wc->rxd, cmd)) {
+						DTE_PRINTK(ERR,
+						  "Failed submit in %s\n",
+						  __func__);
+						free_cmd(cmd);
+					}
+				}
+			}
 			reg |= RX_COMPLETE_INTERRUPT;
 		}
 #if DEFERRED_PROCESSING == WORKQUEUE
@@ -2244,8 +2293,7 @@
 static void 
 wctc4xxp_enable_interrupts(struct wcdte *wc)
 {
-	wctc4xxp_setintmask(wc, 0x000180c1);
-	// wctc4xxp_setintmask(wc, 0xffffffff);
+	wctc4xxp_setintmask(wc, 0x000180c0);
 }
 
 static void 
@@ -2654,26 +2702,30 @@
 {
 	struct dahdi_transcoder_channel *dtc1, *dtc2;
 	struct channel_pvt *cpvt1, *cpvt2;
-	int chan1, chan2;
+	int chan1, chan2, timeslot1, timeslot2;
 	int res;
 
 	if (cpvt->encoder) {
 		chan1 = cpvt->chan_in_num;
+		timeslot1 = cpvt->timeslot_in_num;
 		chan2 = cpvt->chan_out_num;
+		timeslot2 = cpvt->timeslot_out_num;
 	} else {
 		chan1 = cpvt->chan_out_num;
+		timeslot1 = cpvt->timeslot_out_num;
 		chan2 = cpvt->chan_in_num;
-	}
-
-	if (chan1/2 >= wc->numchannels || chan2/2 >= wc->numchannels) {
+		timeslot2 = cpvt->timeslot_in_num;
+	}
+
+	if (timeslot1/2 >= wc->numchannels || timeslot2/2 >= wc->numchannels) {
 		DTE_PRINTK(WARNING, 
-		 "Invalid channel numbers in %s. chan1:%d chan2: %d\n", 
-		 __FUNCTION__, chan1/2, chan2/2);
+		 "Invalid channel numbers in %s. chan1:%d chan2: %d\n",
+		 __func__, timeslot1/2, timeslot2/2);
 		return 0;
 	}
 
-	dtc1 = &(wc->uencode->channels[chan1/2]);
-	dtc2 = &(wc->udecode->channels[chan2/2]);
+	dtc1 = &(wc->uencode->channels[timeslot1/2]);
+	dtc2 = &(wc->udecode->channels[timeslot2/2]);
 	cpvt1 = dtc1->pvt;
 	cpvt2 = dtc2->pvt;
 
@@ -2779,10 +2831,8 @@
 wctc4xxp_setup_channels(struct wcdte *wc)
 {
 	int ret;
-	if ((ret=down_interruptible(&wc->chansem))) {
-		WARN_ALWAYS();
-		return ret;
-	}
+
+	down(&wc->chansem);
 	ret = __wctc4xxp_setup_channels(wc);
 	up(&wc->chansem);
 
@@ -3018,8 +3068,10 @@
 	init_MUTEX(&wc->chansem);
 	spin_lock_init(&wc->reglock);
 	spin_lock_init(&wc->cmd_list_lock);
+	spin_lock_init(&wc->rx_list_lock);
 	INIT_LIST_HEAD(&wc->cmd_list);
 	INIT_LIST_HEAD(&wc->waiting_for_response_list);
+	INIT_LIST_HEAD(&wc->rx_list);
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
 	INIT_WORK(&wc->deferred_work, deferred_work_func, wc);
 #else

Modified: linux/team/tzafrir/sysfs/drivers/dahdi/wctdm.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/wctdm.c?view=diff&rev=5915&r1=5914&r2=5915
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/wctdm.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/wctdm.c Thu Jan 29 15:16:06 2009
@@ -239,7 +239,8 @@
 			int palarms;
 			int reversepolarity;		/* Reverse Line */
 			int mwisendtype;
-			int vmwimessages;		/* 0=none 1-255=number of messages */
+			struct dahdi_vmwi_info vmwisetting;
+			int vmwi_active_messages;
 			int vmwi_lrev:1;		/* MWI Line Reversal*/
 			int vmwi_hvdc:1;		/* MWI High Voltage DC Idle line */
 			int vmwi_hvac:1;		/* MWI Neon High Voltage AC Idle line */
@@ -1450,6 +1451,47 @@
 	return 0;
 }
 
+static int set_vmwi(struct wctdm * wc, int chan_idx)
+{
+	if (wc->mod[chan_idx].fxs.vmwi_active_messages){
+		wc->mod[chan_idx].fxs.vmwi_lrev = (wc->mod[chan_idx].fxs.vmwisetting.vmwi_type & DAHDI_VMWI_LREV)?1:0;
+		wc->mod[chan_idx].fxs.vmwi_hvdc = (wc->mod[chan_idx].fxs.vmwisetting.vmwi_type & DAHDI_VMWI_HVDC)?1:0;
+		wc->mod[chan_idx].fxs.vmwi_hvac = (wc->mod[chan_idx].fxs.vmwisetting.vmwi_type & DAHDI_VMWI_HVAC)?1:0;
+	} else {
+		wc->mod[chan_idx].fxs.vmwi_lrev = 0;
+		wc->mod[chan_idx].fxs.vmwi_hvdc = 0;
+		wc->mod[chan_idx].fxs.vmwi_hvac = 0;
+	}
+
+	if (debug) {
+		printk(KERN_DEBUG "Setting VMWI on channel %d, messages=%d, lrev=%d, hvdc=%d, hvac=%d\n",
+			   chan_idx,
+	  wc->mod[chan_idx].fxs.vmwi_active_messages,
+   wc->mod[chan_idx].fxs.vmwi_lrev,
+   wc->mod[chan_idx].fxs.vmwi_hvdc,
+   wc->mod[chan_idx].fxs.vmwi_hvac
+			  );
+	}
+	if (POLARITY_XOR(chan_idx)) {
+		wc->mod[chan_idx].fxs.idletxhookstate |= 0x4;
+		/* Do not set while currently ringing or open */
+		if (wc->mod[chan_idx].fxs.lasttxhook != 0x04 &&
+				  wc->mod[chan_idx ].fxs.lasttxhook != 0x00) {
+			wc->mod[chan_idx ].fxs.lasttxhook |= 0x4;
+			wctdm_setreg(wc, chan_idx, 64, wc->mod[chan_idx].fxs.lasttxhook);
+				  }
+	} else {
+		wc->mod[chan_idx].fxs.idletxhookstate &= ~0x04;
+		/* Do not set while currently ringing or open */
+		if (wc->mod[chan_idx].fxs.lasttxhook != 0x04 &&
+				  wc->mod[chan_idx].fxs.lasttxhook != 0x00) {
+			wc->mod[chan_idx].fxs.lasttxhook &= ~0x04;
+			wctdm_setreg(wc, chan_idx, 64, wc->mod[chan_idx].fxs.lasttxhook);
+				  }
+	}
+	return 0;
+}
+
 static int wctdm_init_voicedaa(struct wctdm *wc, int card, int fast, int manual, int sane)
 {
 	unsigned char reg16=0, reg26=0, reg30=0, reg31=0;
@@ -1568,12 +1610,12 @@
 		return -2;
 	

[... 385 lines stripped ...]



More information about the dahdi-commits mailing list