[svn-commits] sruffell: linux/trunk r8178 - /linux/trunk/drivers/dahdi/wcte12xp/base.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Mar 1 02:14:32 CST 2010


Author: sruffell
Date: Mon Mar  1 02:14:22 2010
New Revision: 8178

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8178
Log:
wcte12xp: Increase a few timeouts, and cleanup on timeout.

Also, check for good frames as the wctdm24xxp driver does now.

Modified:
    linux/trunk/drivers/dahdi/wcte12xp/base.c

Modified: linux/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=8178&r1=8177&r2=8178
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/base.c Mon Mar  1 02:14:22 2010
@@ -575,8 +575,11 @@
 	cmd->data = 0x00;
 	cmd->flags = __CMD_RD;
 	submit_cmd(wc, cmd);
-	ret = wait_for_completion_timeout(&cmd->complete, HZ/5);
+	ret = wait_for_completion_timeout(&cmd->complete, HZ*2);
 	if (unlikely(!ret)) {
+		spin_lock_bh(&wc->cmd_list_lock);
+		list_del(&cmd->node);
+		spin_unlock_bh(&wc->cmd_list_lock);
 		if (printk_ratelimit()) {
 			dev_warn(&wc->vb.pdev->dev,
 				 "Timeout in %s\n", __func__);
@@ -615,8 +618,11 @@
 	cmd->data = 0x00;
 	cmd->flags = __CMD_PINS;
 	submit_cmd(wc, cmd);
-	ret = wait_for_completion_timeout(&cmd->complete, HZ/5);
+	ret = wait_for_completion_timeout(&cmd->complete, HZ*2);
 	if (unlikely(!ret)) {
+		spin_lock_bh(&wc->cmd_list_lock);
+		list_del(&cmd->node);
+		spin_unlock_bh(&wc->cmd_list_lock);
 		if (printk_ratelimit()) {
 			dev_warn(&wc->vb.pdev->dev,
 				 "Timeout in %s\n", __func__);
@@ -1697,10 +1703,24 @@
 	}
 }
 
+/**
+ * is_good_frame() - Whether the SFRAME received was one sent.
+ *
+ */
+static inline bool is_good_frame(const u8 *sframe)
+{
+        const u8 a = sframe[0*(EFRAME_SIZE+EFRAME_GAP) + (EFRAME_SIZE+1)];
+        const u8 b = sframe[1*(EFRAME_SIZE+EFRAME_GAP) + (EFRAME_SIZE+1)];
+        return a != b;
+}
+
 static inline void t1_receiveprep(struct t1 *wc, const u8* readchunk)
 {
 	int x,chan;
 	unsigned char expected;
+
+	if (!is_good_frame(readchunk))
+		return;
 
 	for (x = 0; x < DAHDI_CHUNKSIZE; x++) {
 		if (likely(test_bit(INITIALIZED, &wc->bit_flags))) {




More information about the svn-commits mailing list