[dahdi-commits] dahdi/linux.git branch "master" updated.

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Thu Mar 7 16:27:30 CST 2013


branch "master" has been updated
       via  d5e5b19a02bb869f0e56455d1ce79edbf7f1cb4e (commit)
       via  a4feafc124da614f8352b353ada39824d79ac5a3 (commit)
       via  0498450db0d57a4e3307f38e6b365f0cbf114bfd (commit)
       via  b6f62324410b9e0407714e104d9dcc6325ce9d9d (commit)
       via  37a783b0feeef280548f28b1d6bb8ee992930aa7 (commit)
       via  37371f19e97e5af645082fcafa42d9e18ef574e5 (commit)
      from  66a300f3387b0832a0c027b1e841630c5c4344e9 (commit)

Summary of changes:
 Makefile                     |    6 -
 build_tools/make_version     |    6 +-
 drivers/dahdi/dahdi-base.c   |  353 +++++++++++++++++++++++++++++++++---------
 include/dahdi/dahdi_config.h |    6 +
 include/dahdi/user.h         |    5 +
 5 files changed, 295 insertions(+), 81 deletions(-)


- Log -----------------------------------------------------------------
commit d5e5b19a02bb869f0e56455d1ce79edbf7f1cb4e
Author: Shaun Ruffell <sruffell at digium.com>
Date:   Mon Jan 21 15:45:52 2013 -0600

    dahdi: Tear down conference links when conferences are emptied out.
    
    Otherwise, it's possible for a link to remain in use if a process quits without
    unlinking the conferences. Now when all the channels are removed from the
    conference, any links are also cleaned up.
    
    Signed-off-by: Shaun Ruffell <sruffell at digium.com>

diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index 768855a..779d135 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -1072,10 +1072,27 @@ static unsigned long _chan_in_conf(struct dahdi_chan *chan, unsigned long x)
 	     confmode == DAHDI_CONF_REALANDPSEUDO)) ? 1 : 0;
 }
 
+#ifdef CONFIG_DAHDI_CONFLINK
+static void recalc_maxlinks(void)
+{
+	int x;
+
+	for (x = DAHDI_MAX_CONF - 1; x > 0; x--) {
+		if (conf_links[x].src || conf_links[x].dst) {
+			maxlinks = x + 1;
+			return;
+		}
+	}
+
+	maxlinks = 0;
+}
+#endif
+
 static void dahdi_check_conf(int x)
 {
 	unsigned long res;
 	unsigned long flags;
+	int i;
 
 	/* return if no valid conf number */
 	if (x <= 0)
@@ -1098,6 +1115,17 @@ static void dahdi_check_conf(int x)
 
 	/* Highest conference may have changed */
 	recalc_maxconfs();
+
+#ifdef CONFIG_DAHDI_CONFLINK
+	/* And unlink it from any conflinks */
+	for (i = DAHDI_MAX_CONF - 1; i > 0; i--) {
+		if (conf_links[i].src == x)
+			conf_links[i].src = 0;
+		if (conf_links[i].dst == x)
+			conf_links[i].dst = 0;
+	}
+	recalc_maxlinks();
+#endif
 }
 
 /* enqueue an event on a channel */
@@ -4519,20 +4547,6 @@ static int dahdi_ioctl_spanstat_v1(struct file *file, unsigned long data)
 }
 
 #ifdef CONFIG_DAHDI_CONFLINK
-static void recalc_maxlinks(void)
-{
-	int x;
-
-	for (x = DAHDI_MAX_CONF - 1; x > 0; x--) {
-		if (conf_links[x].src || conf_links[x].dst) {
-			maxlinks = x + 1;
-			return;
-		}
-	}
-
-	maxlinks = 0;
-}
-
 static int dahdi_ioctl_conflink(struct file *file, unsigned long data)
 {
 	struct dahdi_chan *chan;

commit a4feafc124da614f8352b353ada39824d79ac5a3
Author: Shaun Ruffell <sruffell at digium.com>
Date:   Mon Jan 21 12:57:37 2013 -0600

    dahdi: Restore DAHDI_CONFLINK functionality as compile time option.
    
    This is mostly a revert of commit r9463. If you need to use DAHDI_CONFLINK
    ioctl, make sure to define CONFIG_DAHDI_CONFLINK in
    include/dahdi/dahdi_config.h. Apparently there were some users of CONFLINK out
    there still.
    
    It's a compile time option now since most users won't need to run the test for
    conflinks in the hot-path that is the process_masterspan function.
    
    Signed-off-by: Shaun Ruffell <sruffell at digium.com>
    Tested-by: Ted Gerold <ted at twg.org>

diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index e8275b6..768855a 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -176,6 +176,17 @@ static sumtype *conf_sums_prev;
 static struct dahdi_span *master;
 struct file_operations *dahdi_transcode_fops = NULL;
 
+
+#ifdef CONFIG_DAHDI_CONFLINK
+static struct {
+	int	src;	/* source conf number */
+	int	dst;	/* dst conf number */
+} conf_links[DAHDI_MAX_CONF + 1];
+
+static int maxlinks;
+
+#endif
+
 #ifdef CONFIG_DAHDI_CORE_TIMER
 
 static struct core_timer {
@@ -4507,6 +4518,104 @@ static int dahdi_ioctl_spanstat_v1(struct file *file, unsigned long data)
 	return ret;
 }
 
+#ifdef CONFIG_DAHDI_CONFLINK
+static void recalc_maxlinks(void)
+{
+	int x;
+
+	for (x = DAHDI_MAX_CONF - 1; x > 0; x--) {
+		if (conf_links[x].src || conf_links[x].dst) {
+			maxlinks = x + 1;
+			return;
+		}
+	}
+
+	maxlinks = 0;
+}
+
+static int dahdi_ioctl_conflink(struct file *file, unsigned long data)
+{
+	struct dahdi_chan *chan;
+	struct dahdi_confinfo conf;
+	unsigned long flags;
+	int res = 0;
+	int i;
+
+	chan = chan_from_file(file);
+	if (!chan)
+		return -EINVAL;
+	if (!(chan->flags & DAHDI_FLAG_AUDIO))
+		return -EINVAL;
+	if (copy_from_user(&conf, (void __user *)data, sizeof(conf)))
+		return -EFAULT;
+	/* check sanity of arguments */
+	if ((conf.chan < 0) || (conf.chan > DAHDI_MAX_CONF))
+		return -EINVAL;
+	if ((conf.confno < 0) || (conf.confno > DAHDI_MAX_CONF))
+		return -EINVAL;
+	/* cant listen to self!! */
+	if (conf.chan && (conf.chan == conf.confno))
+		return -EINVAL;
+
+	spin_lock_irqsave(&chan_lock, flags);
+	spin_lock(&chan->lock);
+
+	/* if to clear all links */
+	if ((!conf.chan) && (!conf.confno)) {
+		/* clear all the links */
+		memset(conf_links, 0, sizeof(conf_links));
+		recalc_maxlinks();
+		spin_unlock(&chan->lock);
+		spin_unlock_irqrestore(&chan_lock, flags);
+		return 0;
+	}
+	/* look for already existant specified combination */
+	for (i = 1; i <= DAHDI_MAX_CONF; i++) {
+		/* if found, exit */
+		if ((conf_links[i].src == conf.chan) &&
+		    (conf_links[i].dst == conf.confno))
+			break;
+	}
+	if (i <= DAHDI_MAX_CONF) { /* if found */
+		if (!conf.confmode) { /* if to remove link */
+			conf_links[i].src = 0;
+			conf_links[i].dst = 0;
+		} else { /* if to add and already there, error */
+			res = -EEXIST;
+		}
+	} else { /* if not found */
+		if (conf.confmode) { /* if to add link */
+			/* look for empty location */
+			for (i = 1; i <= DAHDI_MAX_CONF; i++) {
+				/* if empty, exit loop */
+				if ((!conf_links[i].src) &&
+				    (!conf_links[i].dst))
+					break;
+			}
+			/* if empty spot found */
+			if (i <= DAHDI_MAX_CONF) {
+				conf_links[i].src = conf.chan;
+				conf_links[i].dst = conf.confno;
+			} else { /* if no empties -- error */
+				res = -ENOSPC;
+			 }
+		} else { /* if to remove, and not found -- error */
+			res = -ENOENT;
+		}
+	}
+	recalc_maxlinks();
+	spin_unlock(&chan->lock);
+	spin_unlock_irqrestore(&chan_lock, flags);
+	return res;
+}
+#else
+static int dahdi_ioctl_conflink(struct file *file, unsigned long data)
+{
+	return -ENOSYS;
+}
+#endif
+
+
 static int dahdi_common_ioctl(struct file *file, unsigned int cmd,
 			      unsigned long data)
 {
@@ -4535,6 +4644,10 @@ static int dahdi_common_ioctl(struct file *file, unsigned int cmd,
 	case DAHDI_CHANDIAG_V1: /* Intentional drop through. */
 	case DAHDI_CHANDIAG:
 		return dahdi_ioctl_chandiag(file, data);
+
+	case DAHDI_CONFLINK:
+		return dahdi_ioctl_conflink(file, data);
+
 	default:
 		return -ENOTTY;
 	}
@@ -5607,10 +5720,10 @@ static int dahdi_ioctl_confdiag(struct file *file, unsigned long data)
 	for (i = ((j) ? j : 1); i <= ((j) ? j : DAHDI_MAX_CONF); i++) {
 		struct dahdi_span *s;
 		struct pseudo_chan *pseudo;
+		int k;
 		c = 0;
 		spin_lock_irqsave(&chan_lock, flags);
 		list_for_each_entry(s, &span_list, spans_node) {
-			int k;
 			for (k = 0; k < s->channels; k++) {
 				chan = s->chans[k];
 				if (chan->confna != i)
@@ -5632,6 +5745,29 @@ static int dahdi_ioctl_confdiag(struct file *file, unsigned long data)
 			module_printk(KERN_NOTICE, "chan %d, mode %x\n",
 				      pseudo->chan.channo, pseudo->chan.confmode);
 		}
+
+#ifdef CONFIG_DAHDI_CONFLINK
+		{
+			int rv;
+			rv = 0;
+			for (k = 1; k <= DAHDI_MAX_CONF; k++) {
+				if (conf_links[k].dst == i) {
+					if (!c) {
+						c = 1;
+						module_printk(KERN_NOTICE,
+							      "Conf #%d:\n", i);
+					}
+					if (!rv) {
+						rv = 1;
+						module_printk(KERN_NOTICE,
+							      "Snooping on:\n");
+					}
+					module_printk(KERN_NOTICE, "conf %d\n",
+						      conf_links[k].src);
+				}
+			}
+		}
+#endif
 		spin_unlock_irqrestore(&chan_lock, flags);
 		if (c)
 			module_printk(KERN_NOTICE, "\n");
@@ -9714,6 +9850,29 @@ static void _process_masterspan(void)
 		spin_unlock(&pseudo->chan.lock);
 	}
 
+#ifdef CONFIG_DAHDI_CONFLINK
+	if (maxlinks) {
+		int z;
+		int y;
+#ifdef CONFIG_DAHDI_MMX
+		dahdi_kernel_fpu_begin();
+#endif
+		/* process all the conf links */
+		for (x = 1; x <= maxlinks; x++) {
+			/* if we have a destination conf */
+			z = confalias[conf_links[x].dst];
+			if (z) {
+				y = confalias[conf_links[x].src];
+				if (y)
+					ACSS(conf_sums[z], conf_sums[y]);
+			}
+		}
+#ifdef CONFIG_DAHDI_MMX
+		dahdi_kernel_fpu_end();
+#endif
+	}
+#endif /* CONFIG_DAHDI_CONFLINK */
+
 	/* do all the pseudo/conferenced channel transmits (putbuf's) */
 	list_for_each_entry(pseudo, &pseudo_chans, node) {
 		pseudo_rx_audio(&pseudo->chan);
diff --git a/include/dahdi/dahdi_config.h b/include/dahdi/dahdi_config.h
index 0957689..6af9953 100644
--- a/include/dahdi/dahdi_config.h
+++ b/include/dahdi/dahdi_config.h
@@ -190,4 +190,10 @@
  */
 /* #define CONFIG_DAHDI_MIRROR */
 
+/*
+ * Adds support for conference links. There are some non-Asterisk users of this
+ * functionality.
+ */
+/* #define CONFIG_DAHDI_CONFLINK */
+
 #endif
diff --git a/include/dahdi/user.h b/include/dahdi/user.h
index 5f2d192..68e72e0 100644
--- a/include/dahdi/user.h
+++ b/include/dahdi/user.h
@@ -637,6 +637,11 @@ struct dahdi_confinfo {
 #define DAHDI_SETCONF			_IOWR(DAHDI_CODE, 13, struct dahdi_confinfo)
 
 /*
+ * Setup or Remove Conference Link
+ */
+#define DAHDI_CONFLINK			_IOW(DAHDI_CODE, 14, struct dahdi_confinfo)
+
+/*
  * Display Conference Diagnostic Information on Console
  */
 #define DAHDI_CONFDIAG_V1		_IOR(DAHDI_CODE, 15, int)

commit 0498450db0d57a4e3307f38e6b365f0cbf114bfd
Author: Shaun Ruffell <sruffell at digium.com>
Date:   Tue Jan 15 04:00:29 2013 -0600

    dahdi: Give timers their own file_operations
    
    Trades the memory of a file_operations structure to eliminate some tests in the
    timer operations.
    
    Internal-Issue-ID: ABE-2904
    Signed-off-by: Shaun Ruffell <sruffell at digium.com>

diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index cbab2fb..e8275b6 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -2958,7 +2958,9 @@ static int initialize_channel(struct dahdi_chan *chan)
 	return 0;
 }
 
-static int dahdi_timing_open(struct file *file)
+static const struct file_operations dahdi_timer_fops;
+
+static int dahdi_timer_open(struct file *file)
 {
 	struct dahdi_timer *t = kzalloc(sizeof(*t), GFP_KERNEL);
 	if (!t)
@@ -2967,10 +2969,12 @@ static int dahdi_timing_open(struct file *file)
 	init_waitqueue_head(&t->sel);
 	file->private_data = t;
 	spin_lock_init(&t->lock);
+	file->f_op = &dahdi_timer_fops;
+
 	return 0;
 }
 
-static int dahdi_timer_release(struct file *file)
+static int dahdi_timer_release(struct inode *inode, struct file *file)
 {
 	struct dahdi_timer *timer = file->private_data;
 	unsigned long flags;
@@ -3227,7 +3231,7 @@ static int dahdi_open(struct inode *inode, struct file *file)
 	}
 	if (unit == DAHDI_TIMER) {
 		if (can_open_timer()) {
-			return dahdi_timing_open(file);
+			return dahdi_timer_open(file);
 		} else {
 			return -ENXIO;
 		}
@@ -3729,7 +3733,7 @@ static int dahdi_release(struct inode *inode, struct file *file)
 	if (unit == DAHDI_CTL)
 		return dahdi_ctl_release(file);
 	if (unit == DAHDI_TIMER) {
-		return dahdi_timer_release(file);
+		return dahdi_timer_release(inode, file);
 	}
 	if (unit == DAHDI_TRANSCODE) {
 		/* We should not be here because the dahdi_transcode.ko module
@@ -3879,10 +3883,14 @@ void dahdi_alarm_notify(struct dahdi_span *span)
 	}
 }
 
-static int dahdi_timer_ioctl(struct file *file, unsigned int cmd, unsigned long data, struct dahdi_timer *timer)
+static long
+dahdi_timer_unlocked_ioctl(struct file *file, unsigned int cmd,
+			   unsigned long data)
 {
 	int j;
 	unsigned long flags;
+	struct dahdi_timer *const timer = file->private_data;
+
 	switch(cmd) {
 	case DAHDI_TIMERCONFIG:
 		get_user(j, (int __user *)data);
@@ -3950,6 +3958,14 @@ static int dahdi_timer_ioctl(struct file *file, unsigned int cmd, unsigned long
 	return 0;
 }
 
+#ifndef HAVE_UNLOCKED_IOCTL
+static int dahdi_timer_ioctl(struct inode *inode, struct file *file,
+		unsigned int cmd, unsigned long data)
+{
+	return dahdi_timer_unlocked_ioctl(file, cmd, data);
+}
+#endif
+
 static int dahdi_ioctl_getgains(struct file *file, unsigned long data)
 {
 	int res = 0;
@@ -6715,7 +6731,6 @@ static long
 dahdi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long data)
 {
 	int unit = UNIT(file);
-	struct dahdi_timer *timer;
 	int ret;
 
 	if (unit == DAHDI_CTL) {
@@ -6732,11 +6747,10 @@ dahdi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long data)
 	}
 
 	if (unit == DAHDI_TIMER) {
-		timer = file->private_data;
-		if (timer)
-			ret = dahdi_timer_ioctl(file, cmd, data, timer);
-		else
-			ret = -EINVAL;
+		/* The file operations for a timer device should have been
+		 * updated. */
+		WARN_ON(1);
+		ret = -EFAULT;
 		goto exit;
 	}
 	if (unit == DAHDI_CHANNEL) {
@@ -10005,6 +10019,20 @@ static const struct file_operations dahdi_fops = {
 	.poll    = dahdi_poll,
 };
 
+static const struct file_operations dahdi_timer_fops = {
+	.owner   = THIS_MODULE,
+	.release = dahdi_timer_release,
+#ifdef HAVE_UNLOCKED_IOCTL
+	.unlocked_ioctl  = dahdi_timer_unlocked_ioctl,
+#ifdef HAVE_COMPAT_IOCTL
+	.compat_ioctl = dahdi_timer_unlocked_ioctl,
+#endif
+#else
+	.ioctl   = dahdi_timer_ioctl,
+#endif
+	.poll    = dahdi_timer_poll,
+};
+
 /*
  * DAHDI stability should not depend on the calling process behaviour.
  * In case of suprise device removal, we should be able to return

commit b6f62324410b9e0407714e104d9dcc6325ce9d9d
Author: Shaun Ruffell <sruffell at digium.com>
Date:   Mon Jan 14 15:54:02 2013 -0600

    dahdi: Decrease dahdi_timer_lock contention.
    
    On SMP systems there isn't a need for all dahdi timers to
    synchronize on dahdi_timer_lock. Instead give each timer it's own
    lock to synchronize with process_timers and use dahdi_timer_lock to
    protect the global list of locks.
    
    Also, the dahdi_timers list now only contains timers that are set to
    fire. This eliminates a test for each timer in the hot path of the
    process_masterspan context.
    
    Reduces system load on many-core systems which are heavy users of
    DAHDI timers.
    
    Internal-Issue-ID: ABE-2904
    Signed-off-by: Shaun Ruffell <sruffell at digium.com>

diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index 4734c31..cbab2fb 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -283,6 +283,7 @@ static inline void dahdi_kernel_fpu_end(void)
 #endif
 
 struct dahdi_timer {
+	spinlock_t lock;
 	int ms;			/* Countdown */
 	int pos;		/* Position */
 	int ping;		/* Whether we've been ping'd */
@@ -2959,48 +2960,36 @@ static int initialize_channel(struct dahdi_chan *chan)
 
 static int dahdi_timing_open(struct file *file)
 {
-	struct dahdi_timer *t;
-	unsigned long flags;
-
-	if (!(t = kzalloc(sizeof(*t), GFP_KERNEL)))
+	struct dahdi_timer *t = kzalloc(sizeof(*t), GFP_KERNEL);
+	if (!t)
 		return -ENOMEM;
-
-	init_waitqueue_head(&t->sel);
 	INIT_LIST_HEAD(&t->list);
+	init_waitqueue_head(&t->sel);
 	file->private_data = t;
-
-	spin_lock_irqsave(&dahdi_timer_lock, flags);
-	list_add(&t->list, &dahdi_timers);
-	spin_unlock_irqrestore(&dahdi_timer_lock, flags);
-
+	spin_lock_init(&t->lock);
 	return 0;
 }
 
 static int dahdi_timer_release(struct file *file)
 {
-	struct dahdi_timer *t, *cur, *next;
+	struct dahdi_timer *timer = file->private_data;
 	unsigned long flags;
 
-	if (!(t = file->private_data))
+	if (!timer)
 		return 0;
 
-	spin_lock_irqsave(&dahdi_timer_lock, flags);
-
-	list_for_each_entry_safe(cur, next, &dahdi_timers, list) {
-		if (t == cur) {
-			list_del(&cur->list);
-			break;
-		}
-	}
-
-	spin_unlock_irqrestore(&dahdi_timer_lock, flags);
-
-	if (!cur) {
-		module_printk(KERN_NOTICE, "Timer: Not on list??\n");
-		return 0;
+	spin_lock_irqsave(&timer->lock, flags);
+	if (!list_empty(&timer->list)) {
+		spin_unlock(&timer->lock);
+		spin_lock(&dahdi_timer_lock);
+		spin_lock(&timer->lock);
+		list_del_init(&timer->list);
+		spin_unlock(&dahdi_timer_lock);
 	}
+	file->private_data = NULL;
+	spin_unlock_irqrestore(&timer->lock, flags);
 
-	kfree(cur);
+	kfree(timer);
 
 	return 0;
 }
@@ -3899,39 +3888,61 @@ static int dahdi_timer_ioctl(struct file *file, unsigned int cmd, unsigned long
 		get_user(j, (int __user *)data);
 		if (j < 0)
 			j = 0;
-		spin_lock_irqsave(&dahdi_timer_lock, flags);
-		timer->ms = timer->pos = j;
-		spin_unlock_irqrestore(&dahdi_timer_lock, flags);
+		spin_lock_irqsave(&timer->lock, flags);
+		if (timer->ms != j) {
+			if (j && list_empty(&timer->list)) {
+				/* The timer is being activated so add to the
+				 * global timer list. */
+				spin_unlock(&timer->lock);
+				spin_lock(&dahdi_timer_lock);
+				spin_lock(&timer->lock);
+				timer->ms = timer->pos = j;
+				list_add(&timer->list, &dahdi_timers);
+				spin_unlock(&dahdi_timer_lock);
+			} else if (!j && !list_empty(&timer->list)) {
+				/* The timer is being disabled so we can remove
+				 * from the global timer list. */
+				spin_unlock(&timer->lock);
+				spin_lock(&dahdi_timer_lock);
+				spin_lock(&timer->lock);
+				list_del_init(&timer->list);
+				timer->ms = timer->pos = j;
+				spin_unlock(&dahdi_timer_lock);
+			} else {
+				timer->ms = timer->pos = j;
+			}
+		}
+		spin_unlock_irqrestore(&timer->lock, flags);
 		break;
 	case DAHDI_TIMERACK:
 		get_user(j, (int __user *)data);
-		spin_lock_irqsave(&dahdi_timer_lock, flags);
+		spin_lock_irqsave(&timer->lock, flags);
 		if ((j < 1) || (j > timer->tripped))
 			j = timer->tripped;
 		timer->tripped -= j;
-		spin_unlock_irqrestore(&dahdi_timer_lock, flags);
+		spin_unlock_irqrestore(&timer->lock, flags);
 		break;
 	case DAHDI_GETEVENT:  /* Get event on queue */
 		j = DAHDI_EVENT_NONE;
-		spin_lock_irqsave(&dahdi_timer_lock, flags);
+		spin_lock_irqsave(&timer->lock, flags);
 		  /* set up for no event */
 		if (timer->tripped)
 			j = DAHDI_EVENT_TIMER_EXPIRED;
 		if (timer->ping)
 			j = DAHDI_EVENT_TIMER_PING;
-		spin_unlock_irqrestore(&dahdi_timer_lock, flags);
+		spin_unlock_irqrestore(&timer->lock, flags);
 		put_user(j, (int __user *)data);
 		break;
 	case DAHDI_TIMERPING:
-		spin_lock_irqsave(&dahdi_timer_lock, flags);
+		spin_lock_irqsave(&timer->lock, flags);
 		timer->ping = 1;
 		wake_up_interruptible(&timer->sel);
-		spin_unlock_irqrestore(&dahdi_timer_lock, flags);
+		spin_unlock_irqrestore(&timer->lock, flags);
 		break;
 	case DAHDI_TIMERPONG:
-		spin_lock_irqsave(&dahdi_timer_lock, flags);
+		spin_lock_irqsave(&timer->lock, flags);
 		timer->ping = 0;
-		spin_unlock_irqrestore(&dahdi_timer_lock, flags);
+		spin_unlock_irqrestore(&timer->lock, flags);
 		break;
 	default:
 		return -ENOTTY;
@@ -9300,14 +9311,14 @@ static void process_timers(void)
 
 	spin_lock(&dahdi_timer_lock);
 	list_for_each_entry(cur, &dahdi_timers, list) {
-		if (cur->ms) {
-			cur->pos -= DAHDI_CHUNKSIZE;
-			if (cur->pos <= 0) {
-				cur->tripped++;
-				cur->pos = cur->ms;
-				wake_up_interruptible(&cur->sel);
-			}
+		spin_lock(&cur->lock);
+		cur->pos -= DAHDI_CHUNKSIZE;
+		if (cur->pos <= 0) {
+			cur->tripped++;
+			cur->pos = cur->ms;
+			wake_up_interruptible(&cur->sel);
 		}
+		spin_unlock(&cur->lock);
 	}
 	spin_unlock(&dahdi_timer_lock);
 }
@@ -9319,10 +9330,10 @@ static unsigned int dahdi_timer_poll(struct file *file, struct poll_table_struct
 	int ret = 0;
 	if (timer) {
 		poll_wait(file, &timer->sel, wait_table);
-		spin_lock_irqsave(&dahdi_timer_lock, flags);
+		spin_lock_irqsave(&timer->lock, flags);
 		if (timer->tripped || timer->ping)
 			ret |= POLLPRI;
-		spin_unlock_irqrestore(&dahdi_timer_lock, flags);
+		spin_unlock_irqrestore(&timer->lock, flags);
 	} else {
 		/*
 		 * This should never happen. Surprise device removal

commit 37a783b0feeef280548f28b1d6bb8ee992930aa7
Author: Shaun Ruffell <sruffell at digium.com>
Date:   Mon Jan 14 15:59:41 2013 -0600

    dahdi: Remove call to lock_kernel when calling unlocked_ioctl.
    
    The Big Kernel Lock removal is no longer experimental so we can eliminate the
    call to lock_kernel when calling unlock_ioctl.
    
    Internal-Issue-ID: ABE-2904
    Signed-off-by: Shaun Ruffell <sruffell at digium.com>

diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c
index 8121e44..4734c31 100644
--- a/drivers/dahdi/dahdi-base.c
+++ b/drivers/dahdi/dahdi-base.c
@@ -6707,13 +6707,9 @@ dahdi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long data)
 	struct dahdi_timer *timer;
 	int ret;
 
-#if defined(HAVE_UNLOCKED_IOCTL) && defined(CONFIG_BKL)
-	lock_kernel();
-#endif
-
 	if (unit == DAHDI_CTL) {
 		ret = dahdi_ctl_ioctl(file, cmd, data);
-		goto unlock_exit;
+		goto exit;
 	}
 
 	if (unit == DAHDI_TRANSCODE) {
@@ -6721,7 +6717,7 @@ dahdi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long data)
 		 * this file object on open, so we shouldn't be here. */
 		WARN_ON(1);
 		ret = -EFAULT;
-		goto unlock_exit;
+		goto exit;
 	}
 
 	if (unit == DAHDI_TIMER) {
@@ -6730,36 +6726,33 @@ dahdi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long data)
 			ret = dahdi_timer_ioctl(file, cmd, data, timer);
 		else
 			ret = -EINVAL;
-		goto unlock_exit;
+		goto exit;
 	}
 	if (unit == DAHDI_CHANNEL) {
 		if (file->private_data)
 			ret = dahdi_chan_ioctl(file, cmd, data);
 		else
 			ret = dahdi_prechan_ioctl(file, cmd, data);
-		goto unlock_exit;
+		goto exit;
 	}
 	if (unit == DAHDI_PSEUDO) {
 		if (!file->private_data) {
 			module_printk(KERN_NOTICE, "No pseudo channel structure to read?\n");
 			ret = -EINVAL;
-			goto unlock_exit;
+			goto exit;
 		}
 		ret = dahdi_chanandpseudo_ioctl(file, cmd, data);
-		goto unlock_exit;
+		goto exit;
 	}
 
 	if (!file->private_data) {
 		ret = -ENXIO;
-		goto unlock_exit;
+		goto exit;
 	}
 
 	ret = dahdi_chan_ioctl(file, cmd, data);
 
-unlock_exit:
-#if defined(HAVE_UNLOCKED_IOCTL) && defined(CONFIG_BKL)
-	unlock_kernel();
-#endif
+exit:
 	return ret;
 }
 

commit 37371f19e97e5af645082fcafa42d9e18ef574e5
Author: Shaun Ruffell <sruffell at digium.com>
Date:   Fri Jan 25 12:54:18 2013 -0600

    build_tools/make_version: If making from a tag show only the tag in the version.
    
    Also, if there is no other version information use the directory name. Downloads
    from gitweb will include the sha information in the build and otherwise a user
    could locate the source directory via the embedded version information. I
    believe this is better than an empty string.
    
    Signed-off-by: Shaun Ruffell <sruffell at digium.com>

diff --git a/Makefile b/Makefile
index 7e478ca..73a30b5 100644
--- a/Makefile
+++ b/Makefile
@@ -67,13 +67,7 @@ GENERATED_DOCS:=README.html
 ifneq ($(wildcard .version),)
   DAHDIVERSION:=$(shell cat .version)
 else
-ifneq ($(wildcard .svn),)
   DAHDIVERSION:=$(shell build_tools/make_version . dahdi/linux)
-else
-ifneq ($(wildcard .git),)
-  DAHDIVERSION:=$(shell build_tools/make_version . dahdi/linux)
-endif
-endif
 endif
 
 all: modules
diff --git a/build_tools/make_version b/build_tools/make_version
index b9bb29f..d06a6bc 100755
--- a/build_tools/make_version
+++ b/build_tools/make_version
@@ -59,7 +59,7 @@ elif [ -d ${1}/.git ]; then
     MODIFIED=""
     SVN_REV=`git log --pretty=full -1 | grep -F "git-svn-id:" | sed -e "s/.*\@\([^\s]*\)\s.*/\1/g"`
     if [ -z "$SVN_REV" ]; then
-        VERSION=`git describe --long --always --tags --dirty=M 2> /dev/null`
+        VERSION=`git describe --tags --dirty=M 2> /dev/null`
         if [ $? -ne 0 ]; then
             if [ "`git ls-files -m | wc -l`" != "0" ]; then
                 MODIFIED="M"
@@ -115,4 +115,8 @@ elif [ -d ${1}/.git ]; then
 
         echo SVN-${RESULT##-}-r${SVN_REV}${MODIFIED}
     fi
+else
+	# Use the directory information in the absence of any other version
+	# information
+	pwd -P
 fi

-----------------------------------------------------------------------


-- 
dahdi/linux.git



More information about the dahdi-commits mailing list