From 2c9a9fe5cea0be98b651d898bc683c43ad3f6745 Mon Sep 17 00:00:00 2001 From: Matthew Fredrickson Date: Mon, 23 Nov 2009 19:39:11 +0000 Subject: git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@7639 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/wcb4xxp/base.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'drivers/dahdi/wcb4xxp') diff --git a/drivers/dahdi/wcb4xxp/base.c b/drivers/dahdi/wcb4xxp/base.c index d7484a7..b6d1c8c 100644 --- a/drivers/dahdi/wcb4xxp/base.c +++ b/drivers/dahdi/wcb4xxp/base.c @@ -1617,7 +1617,6 @@ static int hdlc_rx_frame(struct b4xxp_span *bspan) char debugbuf[256]; unsigned long irq_flags; struct b4xxp *b4 = bspan->parent; - unsigned char stat; fifo = bspan->fifos[2]; @@ -1645,14 +1644,10 @@ static int hdlc_rx_frame(struct b4xxp_span *bspan) zleft = zlen + 1; /* include STAT byte that the HFC injects after FCS */ do { - int truncated; - if (zleft > WCB4XXP_HDLC_BUF_LEN) { - truncated = 1; + if (zleft > WCB4XXP_HDLC_BUF_LEN) j = WCB4XXP_HDLC_BUF_LEN; - } else { - truncated = 0; + else j = zleft; - } spin_lock_irqsave(&b4->fifolock, irq_flags); hfc_setreg_waitbusy(b4, R_FIFO, (fifo << V_FIFO_NUM_SHIFT) | V_FIFO_DIR); @@ -1661,8 +1656,8 @@ static int hdlc_rx_frame(struct b4xxp_span *bspan) spin_unlock_irqrestore(&b4->fifolock, irq_flags); /* don't send STAT byte to DAHDI */ - if ((bspan->sigchan) && (j > 1)) - dahdi_hdlc_putbuf(bspan->sigchan, buf, truncated ? j : j - 1); + if (bspan->sigchan) + dahdi_hdlc_putbuf(bspan->sigchan, buf, (j == WCB4XXP_HDLC_BUF_LEN) ? j : j - 1); zleft -= j; if (DBG_HDLC && DBG_SPANFILTER) { @@ -1671,7 +1666,6 @@ static int hdlc_rx_frame(struct b4xxp_span *bspan) for (i=0; i < j; i++) printk("%02x%c", buf[i], (i < ( j - 1)) ? ' ':'\n'); } } while (zleft > 0); - stat = buf[j - 1]; /* Frame received, increment F2 and get an updated count of frames left */ spin_lock_irqsave(&b4->fifolock, irq_flags); @@ -1690,6 +1684,7 @@ static int hdlc_rx_frame(struct b4xxp_span *bspan) dev_notice(b4->dev, "odd, zlen less then 3?\n"); dahdi_hdlc_abort(bspan->sigchan, DAHDI_EVENT_ABORT); } else { + unsigned char stat = buf[i - 1]; /* if STAT != 0, indicates bad frame */ if (stat != 0x00) { -- cgit v1.2.3