Index: drivers/dahdi/wctdm24xxp/base.c =================================================================== --- drivers/dahdi/wctdm24xxp/base.c (revision 8983) +++ drivers/dahdi/wctdm24xxp/base.c (working copy) @@ -2382,10 +2414,11 @@ do { spin_lock_irqsave(&fxs->lasttxhooklock, flags); - if (SLIC_LF_OPPENDING & fxs->lasttxhook) { + if (SLIC_LF_OPPENDING & fxs->lasttxhook) { spin_unlock_irqrestore(&fxs->lasttxhooklock, flags); - if (timeout++ > 100) + if (timeout++ > 100) { return -1; + } msleep(1); } else { fxs->lasttxhook = (newval & SLIC_LF_SETMASK) | SLIC_LF_OPPENDING; @@ -3000,6 +3033,8 @@ ? SLIC_LF_OHTRAN_REV : SLIC_LF_OHTRAN_FWD , &wc->sethook[chan->chanpos - 1]); } + if (debug & DEBUG_CARD) + dev_info(&wc->vb.pdev->dev, "Channel %d OnHookTransfer start\n", chan->chanpos - 1 ); break; case DAHDI_VMWI_CONFIG: if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS) @@ -3119,21 +3154,40 @@ return -EINVAL; /* Can't change polarity while ringing or when open */ if (((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_RINGING) || - ((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_OPEN)) + ((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_OPEN)) { + if (debug & DEBUG_CARD) { + dev_info(&wc->vb.pdev->dev, "Channel %d Unable to Set Polarity\n", chan->chanpos - 1 ); + } return -EINVAL; + } fxs->reversepolarity = (x) ? 1 : 0; - if (POLARITY_XOR(chan->chanpos -1)) { +// wait_slic_lf_oppending(fxs); + if (POLARITY_XOR(chan->chanpos - 1)) { fxs->idletxhookstate |= SLIC_LF_REVMASK; - x = fxs->lasttxhook; + x = fxs->lasttxhook & SLIC_LF_SETMASK; x |= SLIC_LF_REVMASK; - set_lasttxhook_interruptible(fxs, x, &wc->sethook[chan->chanpos - 1]); + x = set_lasttxhook_interruptible(fxs, x, &wc->sethook[chan->chanpos - 1]); + if (debug & DEBUG_CARD) { + if (x){ + dev_info(&wc->vb.pdev->dev, "Channel %d TIMEOUT: Set Reverse Polarity\n", chan->chanpos - 1); + } else { + dev_info(&wc->vb.pdev->dev, "Channel %d Set Reverse Polarityd\n", chan->chanpos - 1); + } + } } else { fxs->idletxhookstate &= ~SLIC_LF_REVMASK; - x = fxs->lasttxhook; + x = fxs->lasttxhook & SLIC_LF_SETMASK; x &= ~SLIC_LF_REVMASK; - set_lasttxhook_interruptible(fxs, x, &wc->sethook[chan->chanpos - 1]); + x = set_lasttxhook_interruptible(fxs, x, &wc->sethook[chan->chanpos - 1]); + if (debug & DEBUG_CARD) { + if (x){ + dev_info(&wc->vb.pdev->dev, "Channel %d TIMEOUT: Set Normal Polarity\n", chan->chanpos - 1 ); + } else { + dev_info(&wc->vb.pdev->dev, "Channel %d Set Normal Polarity\n", chan->chanpos - 1 ); + } + } } break; case DAHDI_RADIO_GETPARAM: