summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoe Rubinstein <nrubinstein@proformatique.com>2010-12-09 18:30:27 +0100
committerNoe Rubinstein <nrubinstein@proformatique.com>2010-12-09 18:30:27 +0100
commit61cddfd6cae9ebbd4ef40cc8ea45ac5fc68fc162 (patch)
treed3258b9bf97ccb8439fe6af211c60cce68563973
parentab051a7a9cd716ef6c186705527d233fd9db8476 (diff)
clean up traces
-rw-r--r--xhfc/xhfc.c168
-rw-r--r--xhfc/xhfc.h4
-rw-r--r--xhfc/xhfc_st_state.c30
3 files changed, 100 insertions, 102 deletions
diff --git a/xhfc/xhfc.c b/xhfc/xhfc.c
index b4f736d..ad92afc 100644
--- a/xhfc/xhfc.c
+++ b/xhfc/xhfc.c
@@ -191,7 +191,7 @@ int xhfc_config_pcm(struct xhfc *xhfc, int master_or_slave)
return 0;
}
-#define debug_fz(b4, fifo, prefix, buf) \
+#define debug_fz(fifo, prefix, buf) \
do { \
sprintf(buf, "%s(fifo %d): flen=%d, " \
"zlen=%d", prefix, fifo, flen, \
@@ -301,26 +301,21 @@ void xhfc_config_data_flow(struct xhfc* x)
*/
static void hdlc_signal_complete(struct xhfc_span *xhfc_span, u8 stat)
{
- struct xhfc *xhfc = xhfc_span->xhfc;
- struct dahdi_span *dahdi_span = &xhfc_span->span;
-
-/* if STAT != 0, indicates bad frame */
if (stat != 0x00) {
if (DBG_HDLC && DBG_SPAN(xhfc_span)) {
- xhfc_info(xhfc, "(span %d) STAT=0x%02x indicates "
- "frame problem: %s\n", dahdi_span->spanno,
+ printk(KERN_INFO DRIVER_NAME "(port %d) STAT=0x%02x indicates "
+ "frame problem: %s\n", portno(xhfc_span),
stat,
(0xff == stat) ? "HDLC Abort" : "Bad FCS");
}
dahdi_hdlc_abort(xhfc_span->sigchan, (0xff == stat) ?
DAHDI_EVENT_ABORT : DAHDI_EVENT_BADFCS);
-/* STAT == 0, means frame was OK */
} else {
if (DBG_HDLC && DBG_SPAN(xhfc_span)) {
- xhfc_info(xhfc,
- "(span %d) Frame " /*"%d" */ "is good!\n",
- dahdi_span->spanno
+ printk(KERN_INFO DRIVER_NAME
+ "(port %d) Frame " /*"%d" */ "is good!\n",
+ portno(xhfc_span)
/*, xhfc_span->frames_in */ );
}
dahdi_hdlc_finish(xhfc_span->sigchan);
@@ -346,25 +341,28 @@ static int hdlc_rx_frame(struct xhfc_span *xhfc_span)
fifo = dchan_fifo(xhfc_span);
if (DBG_VERBOSE_HDLC && DBG_SPAN(xhfc_span))
- xhfc_info(x, "%s(fifo %d): start\n", __func__, fifo);
+ printk(KERN_INFO DRIVER_NAME ": %s(fifo %d): start\n",
+ __func__, fifo);
xhfc_selfifo(x, fifo, RECEIVE);
flen = get_Flen(x);
zlen = get_Zlen(x);
- debug_fz(x, fifo, __func__, debugbuf);
+ debug_fz(fifo, __func__, debugbuf);
if (!flen && !zlen) {
if (DBG_VERBOSE_HDLC && DBG_SPAN(xhfc_span))
- xhfc_info(x, "%s, nothing to receive (%ld).\n", debugbuf, xhfc_span->non_rx_cnt);
+ printk(KERN_INFO DRIVER_NAME
+ ": %s, nothing to receive (%ld)\n",
+ debugbuf, xhfc_span->non_rx_cnt);
xhfc_span->non_rx_cnt++;
return 0;
}
xhfc_span->non_rx_cnt = 0;
if (DBG_VERBOSE_HDLC && DBG_SPAN(xhfc_span))
- xhfc_info(x, "%s\n", debugbuf);
+ printk(KERN_INFO DRIVER_NAME ": %s\n", debugbuf);
/* if we have at least one complete frame, increment zleft to include
* status byte */
@@ -389,10 +387,10 @@ static int hdlc_rx_frame(struct xhfc_span *xhfc_span)
zleft -= j;
- if (DBG_VERBOSE_HDLC && DBG_SPAN(xhfc_span)) {
- xhfc_info(x, "transmitted %d bytes to dahdi, "
- "zleft=%d\n", k, zleft);
- }
+ if (DBG_VERBOSE_HDLC && DBG_SPAN(xhfc_span))
+ printk(KERN_INFO DRIVER_NAME
+ ": transmitted %d bytes to dahdi, "
+ "zleft=%d\n", k, zleft);
if (DBG_HDLC && DBG_SPAN(xhfc_span)) {
dbglen = 0;
@@ -400,8 +398,9 @@ static int hdlc_rx_frame(struct xhfc_span *xhfc_span)
dbglen += sprintf(debugbuf+dbglen, "%02x ", buf[i]);
debugbuf[dbglen] = '\0';
- xhfc_info(x, "%s(fifo %d): zlen=%d, zleft=%d: %s\n",
- __func__, fifo, zlen, zleft, debugbuf);
+ printk(KERN_INFO DRIVER_NAME ": %s(fifo %d): "
+ "zlen=%d, zleft=%d: %s\n", __func__,
+ fifo, zlen, zleft, debugbuf);
}
} while (zleft > 0);
@@ -412,28 +411,19 @@ static int hdlc_rx_frame(struct xhfc_span *xhfc_span)
/* If this channel is not configured with a signalling span we don't
* need to notify the rest of dahdi about this frame. */
if (!xhfc_span->sigchan) {
- if (DBG_HDLC && DBG_SPAN(xhfc_span)) {
- xhfc_info(x, "hdlc_rx_frame(fifo %d): "
- "flen %d, early end.\n", fifo, flen);
- }
+ if (DBG_HDLC && DBG_SPAN(xhfc_span))
+ printk(KERN_INFO DRIVER_NAME
+ ": %s(fifo %d): flen %d, early end\n",
+ __func__, fifo, flen);
return flen;
}
- if (flen) {
-#if 0 /* disable < 3 check for now */
- if (zlen < 3) {
- if (DBG_HDLC && DBG_SPAN(xhfc_span))
- xhfc_info(x, "odd, zlen less then 3?\n");
- dahdi_hdlc_abort(xhfc_span->sigchan, DAHDI_EVENT_ABORT);
- } else
-#endif
+ if (flen)
hdlc_signal_complete(xhfc_span, buf[i - 1]);
- }
- if (DBG_VERBOSE_HDLC && DBG_SPAN(xhfc_span)) {
- xhfc_info(x, "hdlc_rx_frame(fifo %d): flen=%d end.\n",
- fifo, flen);
- }
+ if (DBG_VERBOSE_HDLC && DBG_SPAN(xhfc_span))
+ printk(KERN_INFO DRIVER_NAME ": %s(fifo %d): flen=%d end\n",
+ __func__, fifo, flen);
return flen;
}
@@ -469,12 +459,12 @@ static int hdlc_tx_frame(struct xhfc_span *xhfc_span)
xhfc_selfifo(x, fifo, TRANSMIT);
zlen = get_Zlen(x);
- debug_fz(x, fifo, __func__, debugbuf);
+ debug_fz(fifo, __func__, debugbuf);
/* TODO: check zlen, etc. */
if ((XHFC_ZMAX - zlen) < size) {
static int arg;
- xhfc_info(x, "xhfc: arg (%d), zlen (%d) < what we "
+ printk(KERN_INFO DRIVER_NAME ": arg (%d), zlen (%d) < what we "
"grabbed from DAHDI (%d)!\n", ++arg, zlen, size);
size = zlen;
dahdi_hdlc_abort(xhfc_span->sigchan, DAHDI_EVENT_OVERRUN);
@@ -495,22 +485,22 @@ static int hdlc_tx_frame(struct xhfc_span *xhfc_span)
}
if (DBG_HDLC && DBG_SPAN(xhfc_span)) {
- xhfc_info(xhfc_span->xhfc, "%s\n", debugbuf);
+ printk(KERN_INFO DRIVER_NAME ": %s\n", debugbuf);
dbglen = 0;
for (i = 0; i < size; i++)
dbglen += sprintf(debugbuf+dbglen, "%02x ", buf[i]);
debugbuf[dbglen] = '\0';
- xhfc_info(xhfc_span->xhfc,
- "hdlc_tx_frame(span %d): DAHDI gave %d "
+ printk(KERN_INFO DRIVER_NAME
+ ": hdlc_tx_frame(span %d): DAHDI gave %d "
"bytes for FIFO %d (res = %d): %s\n",
dahdi_span->spanno,
size, fifo, res, debugbuf);
if (size && res != 0)
- xhfc_info(xhfc_span->xhfc,
- "Transmitted frame %d on span %d\n",
+ printk(KERN_INFO DRIVER_NAME
+ ": Transmitted frame %d on span %d\n",
frames_out - 1, dahdi_span->spanno);
}
@@ -523,15 +513,13 @@ void xhfc_hdlc_hard_xmit(struct dahdi_chan *chan)
struct dahdi_span *dahdi_span = chan->span;
struct xhfc_span *xhfc_span =
container_of(dahdi_span, struct xhfc_span, span);
- struct xhfc *xhfc = xhfc_span->xhfc;
-
- if ((DBG_FOPS || DBG_HDLC) && DBG_SPAN(xhfc_span)) {
- xhfc_info(xhfc, "hdlc_hard_xmit on chan %s (%i/%i), " \
- "span=%i (sigchan=%p, chan=%p)\n", chan->name,
- chan->channo, chan->chanpos, dahdi_span->spanno,
- xhfc_span->sigchan, chan);
- }
+ if ((DBG_FOPS || DBG_HDLC) && DBG_SPAN(xhfc_span))
+ printk(KERN_INFO DRIVER_NAME ": %s on chan %s (%i/%i), "
+ "span=%i (sigchan=%p, chan=%p)\n",
+ __func__, chan->name, chan->channo,
+ chan->chanpos, dahdi_span->spanno,
+ xhfc_span->sigchan, chan);
/* Increment the hdlc_pending counter and trigger hdlc_tx_frame */
if (xhfc_span->sigchan == chan)
@@ -766,30 +754,34 @@ int xhfc_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
term = (lc->lineconfig & DAHDI_CONFIG_TERM) ? 1 : 0;
- xhfc_info(xhfc, "xhfc: Configuring port %d span %d in %s " \
- "mode with termination resistance %s\n", xhfc_span->port + 1,
- span->spanno, xhfc_span->nt ? "NT" : "TE",
- term ? "ENABLED" : "DISABLED");
+ printk(KERN_INFO DRIVER_NAME ": Configuring port %d span %d in %s mode"
+ " with termination resistance %s\n",
+ portno(xhfc_span), span->spanno,
+ xhfc_span->nt ? "NT" : "TE",
+ term ? "ENABLED" : "DISABLED");
/* TODO conf hardware interface w/ GPIO */
xhfc_config_st(xhfc, xhfc_span->port, xhfc_span->nt);
- xhfc_info(xhfc, "WARNING: This driver can't configure the ports yet, "
- "expect problems if port %d isn't configured in %s "
- "mode.\n", xhfc_span->port + 1, xhfc_span->nt ? "NT" : "TE");
+ printk(KERN_INFO DRIVER_NAME ": WARNING: This driver can't configure "
+ "the ports yet, expect problems if port %d isn't "
+ "configured in %s mode\n",
+ portno(xhfc_span), xhfc_span->nt ? "NT" : "TE");
if (lc->sync < 0) {
- xhfc_info(xhfc, "Span %d has invalid sync priority (%d), " \
- "removing from sync source list\n", span->spanno,
- lc->sync);
+ printk(KERN_INFO DRIVER_NAME
+ ": Span %d has invalid sync priority (%d), "
+ "removing from sync source list\n",
+ span->spanno, lc->sync);
lc->sync = 0;
}
if (xhfc_span->nt && lc->sync) {
- xhfc_info(xhfc, "NT Spans cannot be timing sources. " \
- "Span %d requested to be timing source of " \
- "priority %d. Changing priority to 0\n", span->offset,
- lc->sync);
+ printk(KERN_INFO DRIVER_NAME
+ ": NT Spans cannot be timing sources. "
+ "Span %d requested to be timing source of "
+ "priority %d. Changing priority to 0\n",
+ span->offset, lc->sync);
lc->sync = 0;
}
@@ -801,40 +793,38 @@ int xhfc_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
int xhfc_chanconfig(struct dahdi_chan *chan, int sigtype)
{
int alreadyrunning;
- struct xhfc_span *bspan = container_of(chan->span, struct xhfc_span, span);
- struct xhfc *b4 = bspan->xhfc;
+ struct xhfc_span *xhfc_span = container_of(chan->span, struct xhfc_span, span);
int res;
- alreadyrunning = bspan->span.flags & DAHDI_FLAG_RUNNING;
+ alreadyrunning = xhfc_span->span.flags & DAHDI_FLAG_RUNNING;
- if (DBG_FOPS) {
- xhfc_info(b4, "%s channel %d (%s) sigtype %08x\n",
- alreadyrunning ? "Reconfigured" : "Configured",
- chan->channo, chan->name, sigtype);
- }
+ if (DBG_FOPS)
+ printk(KERN_INFO DRIVER_NAME
+ ": %s channel %d (%s) sigtype %08x\n",
+ alreadyrunning ? "Reconfigured" : "Configured",
+ chan->channo, chan->name, sigtype);
switch (sigtype) {
case DAHDI_SIG_HARDHDLC:
/* xref1 */
- if (DBG_FOPS) {
- xhfc_info(b4, "%sonfiguring hardware HDLC on %s\n",
- ((sigtype == DAHDI_SIG_HARDHDLC) ? "C" :
- "Unc"), chan->name);
- }
- bspan->sigchan = chan;
- atomic_set(&bspan->hdlc_pending, 0);
+ if (DBG_FOPS)
+ printk(KERN_INFO DRIVER_NAME
+ ": Configuring hardware HDLC on %s\n",
+ chan->name);
+ xhfc_span->sigchan = chan;
+ atomic_set(&xhfc_span->hdlc_pending, 0);
res = 0;
break;
case DAHDI_SIG_HDLCFCS:
- xhfc_info(b4, "HDLCFCS not supported\n");
+ printk(KERN_INFO DRIVER_NAME ": HDLCFCS not supported\n");
res = -ENOSYS;
break;
case DAHDI_SIG_HDLCNET:
- xhfc_info(b4, "HDLCNET not supported\n");
+ printk(KERN_INFO DRIVER_NAME ": HDLCNET not supported\n");
res = -ENOSYS;
break;
case DAHDI_SIG_HDLCRAW:
- xhfc_info(b4, "HDLCRAW not supported\n");
+ printk(KERN_INFO DRIVER_NAME ": HDLCRAW not supported\n");
res = -ENOSYS;
break;
default:
@@ -973,7 +963,7 @@ int __devinit xhfc_init_one(struct pci_dev *pdev,
unsigned long base, size;
int rc = -ENOMEM;
- printk(KERN_DEBUG "entering xhfc_init_one.\n");
+ printk(KERN_DEBUG "entering xhfc_init_one\n");
/****************
@@ -1000,7 +990,7 @@ int __devinit xhfc_init_one(struct pci_dev *pdev,
if (rc)
goto err_enable_device;
- printk(KERN_DEBUG "pci_enable_device succeeded.\n");
+ printk(KERN_DEBUG "pci_enable_device succeeded\n");
rc = pci_request_regions(pdev, DRIVER_NAME);
if (rc)
@@ -1103,7 +1093,7 @@ int __devinit xhfc_init_one(struct pci_dev *pdev,
for (span = 0; span < SPANS_PER_CHIP; span++)
if ((rc = dahdi_register(&pi->xhfc.spans[span].span, /*prefmaster*/ 1)) < 0) {
- printk(KERN_WARNING "%s %s: couldn't register spans.\n", pi->name, __func__);
+ printk(KERN_WARNING "%s %s: couldn't register spans\n", pi->name, __func__);
goto err_in_dahdi_register;
}
@@ -1174,7 +1164,7 @@ void __devexit xhfc_remove_one(struct pci_dev *pdev)
pci_set_drvdata(pdev, NULL);
kfree(pi);
- printk(KERN_DEBUG "%s: bye-bye.\n", __func__);
+ printk(KERN_DEBUG "%s: bye-bye\n", __func__);
}
/***************/
diff --git a/xhfc/xhfc.h b/xhfc/xhfc.h
index f6c525a..aadb566 100644
--- a/xhfc/xhfc.h
+++ b/xhfc/xhfc.h
@@ -85,7 +85,7 @@
#define V_SU_ACT_ACTIVATE 3
#define V_SU_ACT_DEACTIVATE 2
-#define NOT_RUNNING 0
+#define NOT_RUNNING 0 /* timer not running */
enum data_dir { TRANSMIT = 0, RECEIVE = 1 };
@@ -154,7 +154,7 @@ struct xhfc_pi {
};
#define dchan_fifo(span) ((span)->port * 4 + 2)
-#define portno(span) ((span)->port + 1)
+#define portno(span) ((span)->port + 1) /* used for traces */
void xhfc_flush_fifo(struct xhfc* x, int fifo);
int xhfc_hdlc_init(struct xhfc* x);
diff --git a/xhfc/xhfc_st_state.c b/xhfc/xhfc_st_state.c
index 4645447..dfa9897 100644
--- a/xhfc/xhfc_st_state.c
+++ b/xhfc/xhfc_st_state.c
@@ -62,7 +62,7 @@ void activate_request(struct xhfc_span* s)
if (impossible_te || impossible_nt) {
printk(KERN_INFO DRIVER_NAME ": "
"activate impossible by definition of layer 1"
- "in state %c%d on port %d\n",
+ " in state %c%d on port %d\n",
(s->nt ? 'G' : 'F'), sta, portno(s));
return;
} else if (no_action_te) {
@@ -74,10 +74,10 @@ void activate_request(struct xhfc_span* s)
return;
}
- if(DBG_ST && DBG_SPAN(s))
+ if (DBG_ST && DBG_SPAN(s))
printk(KERN_DEBUG DRIVER_NAME
": activate on port %d\n",
- s->port + 1);
+ portno(s));
SET_V_SU_ACT(a_su_wr_sta, V_SU_ACT_ACTIVATE);
@@ -85,22 +85,30 @@ void activate_request(struct xhfc_span* s)
write_xhfc(s->xhfc, R_SU_SEL, s->port);
write_xhfc(s->xhfc, A_SU_WR_STA, a_su_wr_sta);
- if(!s->nt && sta == F3 && GET_V_SU_INFO0(s->state))
+ if (!s->nt && sta == F3 && GET_V_SU_INFO0(s->state))
s->activation_timer = s->xhfc->ticks + T3_MS; /* xref5 */
else
s->activation_timer = NOT_RUNNING;
/* timer for NT activated by state change handler (xref3) */
}
-void deactivate_request(struct xhfc_span* s) /* XXX not called */
+void deactivate_request(struct xhfc_span* s)
{
u8 a_su_wr_sta = 0;
int sta = GET_V_SU_STA(s->state);
+ if (!s->nt || (s->nt && (sta == G1 || sta == G4))) {
+ printk(KERN_INFO DRIVER_NAME ": "
+ "deactivate impossible by definition of layer 1"
+ " in state %c%d on port %d\n",
+ (s->nt ? 'G' : 'F'), sta, portno(s));
+ return;
+ }
+
if(DBG_ST && DBG_SPAN(s))
printk(KERN_DEBUG DRIVER_NAME
": deactivate on port %d\n",
- s->port + 1);
+ portno(s));
SET_V_SU_ACT(a_su_wr_sta, V_SU_ACT_DEACTIVATE);
@@ -113,7 +121,7 @@ void deactivate_request(struct xhfc_span* s) /* XXX not called */
/* This function is meant to be ran each time an interface changes state;
* however, the state change is polled (during the timer interrupt; see
- * enable_interrupts and xhfc_interrupt). Therefore case, it is possible that
+ * enable_interrupts and xhfc_interrupt). Therefore, it is possible that
* two or more state changes happen on the same interface between two
* interruptions and that this functions gets only called once.
* Additionally, even when using the ST state change interrupt, an interruption
@@ -155,7 +163,7 @@ void handle_state_change(struct xhfc_span* s)
if(unlikely(s->prev_state == s->state)) {
printk(KERN_WARNING DRIVER_NAME ": a state change has been "
"reported on port %d but it looks like the "
- "state has not changed?\n", s->port + 1);
+ "state has not changed?\n", portno(s));
return;
}
@@ -242,7 +250,7 @@ static void signal_f7_transition(struct xhfc_span* s)
{
if(DBG_ST && DBG_SPAN(s))
printk(KERN_DEBUG DRIVER_NAME ": signalling transition to F7 "
- "on port %d\n", s->port + 1);
+ "on port %d\n", portno(s));
s->span.alarms = DAHDI_ALARM_NONE;
s->f6_f7_transition = NOT_RUNNING;
@@ -262,7 +270,7 @@ static void activation_timer_expiry(struct xhfc_span* s)
t1_expiry || t3_expiry ? "" : "no action for ",
s->nt ? "NT" : "TE",
s->nt ? 'G' : 'F',
- sta, s->port + 1);
+ sta, portno(s));
s->activation_timer = NOT_RUNNING;
@@ -308,7 +316,7 @@ static void print_state(struct xhfc_span* s)
{
int sta = GET_V_SU_STA(s->state);
printk(KERN_DEBUG DRIVER_NAME ": port %d: %s state %c%d (%s)\n",
- s->port + 1,
+ portno(s),
(s->nt ? "NT" : "TE"),
(s->nt ? 'G' : 'F'),
sta,