Commit f0a4e3a9 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Get rid of #ifdef ISDN_DEBUG_NET_*

No need to sprinkle ugly #ifdef's all over the place, do it once in
the header instead.
parent fb0c37b6
...@@ -24,6 +24,18 @@ ...@@ -24,6 +24,18 @@
#undef ISDN_DEBUG_NET_DIAL #undef ISDN_DEBUG_NET_DIAL
#undef ISDN_DEBUG_NET_ICALL #undef ISDN_DEBUG_NET_ICALL
#ifdef ISDN_DEBUG_NET_DIAL
#define dbg_net_dial(arg...) printk(KERN_DEBUG arg)
#else
#define dbg_net_dial(arg...) do {} while (0)
#endif
#ifdef ISDN_DEBUG_NET_ICALL
#define dbg_net_icall(arg...) printk(KERN_DEBUG arg)
#else
#define dbg_net_icall(arg...) do {} while (0)
#endif
#define isdn_BUG() \ #define isdn_BUG() \
do { printk(KERN_WARNING "ISDN Bug at %s:%d", __FILE__, __LINE__); \ do { printk(KERN_WARNING "ISDN Bug at %s:%d", __FILE__, __LINE__); \
} while(0) } while(0)
...@@ -44,6 +56,8 @@ extern int isdn_msncmp( const char *, const char *); ...@@ -44,6 +56,8 @@ extern int isdn_msncmp( const char *, const char *);
extern int isdn_add_channels(driver *, int, int, int); extern int isdn_add_channels(driver *, int, int, int);
#if defined(ISDN_DEBUG_NET_DUMP) || defined(ISDN_DEBUG_MODEM_DUMP) #if defined(ISDN_DEBUG_NET_DUMP) || defined(ISDN_DEBUG_MODEM_DUMP)
extern void isdn_dumppkt(char *, u_char *, int, int); extern void isdn_dumppkt(char *, u_char *, int, int);
#else
static inline void isdn_dumppkt(char *s, u_char *d, int l, int m) { }
#endif #endif
struct dial_info { struct dial_info {
......
...@@ -758,9 +758,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg) ...@@ -758,9 +758,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
isdn_net_dev *p = lp->netdev; isdn_net_dev *p = lp->netdev;
isdn_ctrl cmd; isdn_ctrl cmd;
#ifdef ISDN_DEBUG_NET_DIAL dbg_net_dial("%s: dialstate=%d\n", lp->name, lp->dialstate);
printk(KERN_DEBUG "%s: dialstate=%d\n", lp->name, lp->dialstate);
#endif
switch (lp->dialstate) { switch (lp->dialstate) {
case ST_0: case ST_0:
...@@ -818,9 +816,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg) ...@@ -818,9 +816,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
/* Wait for B- or D-Channel-connect. If timeout, /* Wait for B- or D-Channel-connect. If timeout,
* switch back to state 3. * switch back to state 3.
*/ */
#ifdef ISDN_DEBUG_NET_DIAL dbg_net_dial("dialtimer2: %d\n", lp->dtimer);
printk(KERN_DEBUG "dialtimer2: %d\n", lp->dtimer);
#endif
if (lp->dtimer++ > ISDN_TIMER_DTIMEOUT10) if (lp->dtimer++ > ISDN_TIMER_DTIMEOUT10)
lp->dialstate = ST_3; lp->dialstate = ST_3;
return 1; return 1;
...@@ -832,9 +828,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg) ...@@ -832,9 +828,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
/* Got incoming Call, setup L2 and L3 protocols, /* Got incoming Call, setup L2 and L3 protocols,
* then wait for D-Channel-connect * then wait for D-Channel-connect
*/ */
#ifdef ISDN_DEBUG_NET_DIAL dbg_net_dial("dialtimer4: %d\n", lp->dtimer);
printk(KERN_DEBUG "dialtimer4: %d\n", lp->dtimer);
#endif
cmd.arg = lp->l2_proto << 8; cmd.arg = lp->l2_proto << 8;
isdn_slot_command(lp->isdn_slot, ISDN_CMD_SETL2, &cmd); isdn_slot_command(lp->isdn_slot, ISDN_CMD_SETL2, &cmd);
cmd.arg = lp->l3_proto << 8; cmd.arg = lp->l3_proto << 8;
...@@ -863,9 +857,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg) ...@@ -863,9 +857,7 @@ isdn_net_handle_event(isdn_net_local *lp, int pr, void *arg)
switch (pr) { switch (pr) {
case EV_NET_DIAL: case EV_NET_DIAL:
/* Wait for B- or D-channel-connect */ /* Wait for B- or D-channel-connect */
#ifdef ISDN_DEBUG_NET_DIAL dbg_net_dial("dialtimer4: %d\n", lp->dtimer);
printk(KERN_DEBUG "dialtimer4: %d\n", lp->dtimer);
#endif
if (lp->dtimer++ > ISDN_TIMER_DTIMEOUT10) if (lp->dtimer++ > ISDN_TIMER_DTIMEOUT10)
isdn_net_hangup(&p->dev); isdn_net_hangup(&p->dev);
else else
...@@ -1304,14 +1296,8 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -1304,14 +1296,8 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
#endif #endif
/* auto-dialing xmit function */ /* auto-dialing xmit function */
{ {
#ifdef ISDN_DEBUG_NET_DUMP
u_char *buf;
#endif
isdn_net_adjust_hdr(skb, ndev); isdn_net_adjust_hdr(skb, ndev);
#ifdef ISDN_DEBUG_NET_DUMP isdn_dumppkt("S:", skb->data, skb->len, 40);
buf = skb->data;
isdn_dumppkt("S:", buf, skb->len, 40);
#endif
if (!(lp->flags & ISDN_NET_CONNECTED)) { if (!(lp->flags & ISDN_NET_CONNECTED)) {
int chi; int chi;
...@@ -1898,9 +1884,7 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb) ...@@ -1898,9 +1884,7 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb)
skb->dev = ndev; skb->dev = ndev;
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
skb->mac.raw = skb->data; skb->mac.raw = skb->data;
#ifdef ISDN_DEBUG_NET_DUMP
isdn_dumppkt("R:", skb->data, skb->len, 40); isdn_dumppkt("R:", skb->data, skb->len, 40);
#endif
switch (lp->p_encap) { switch (lp->p_encap) {
case ISDN_NET_ENCAP_ETHER: case ISDN_NET_ENCAP_ETHER:
/* Ethernet over ISDN */ /* Ethernet over ISDN */
...@@ -2179,9 +2163,7 @@ isdn_net_swapbind(int drvidx) ...@@ -2179,9 +2163,7 @@ isdn_net_swapbind(int drvidx)
{ {
isdn_net_dev *p; isdn_net_dev *p;
#ifdef ISDN_DEBUG_NET_ICALL dbg_net_icall("n_fi: swapping ch of %d\n", drvidx);
printk(KERN_DEBUG "n_fi: swapping ch of %d\n", drvidx);
#endif
p = dev->netdev; p = dev->netdev;
while (p) { while (p) {
if (p->local->pre_device == drvidx) if (p->local->pre_device == drvidx)
...@@ -2203,9 +2185,7 @@ isdn_net_swap_usage(int i1, int i2) ...@@ -2203,9 +2185,7 @@ isdn_net_swap_usage(int i1, int i2)
int u1 = isdn_slot_usage(i1); int u1 = isdn_slot_usage(i1);
int u2 = isdn_slot_usage(i2); int u2 = isdn_slot_usage(i2);
#ifdef ISDN_DEBUG_NET_ICALL dbg_net_icall("n_fi: usage of %d and %d\n", i1, i2);
printk(KERN_DEBUG "n_fi: usage of %d and %d\n", i1, i2);
#endif
isdn_slot_set_usage(i1, (u1 & ~ISDN_USAGE_EXCLUSIVE) | (u2 & ISDN_USAGE_EXCLUSIVE)); isdn_slot_set_usage(i1, (u1 & ~ISDN_USAGE_EXCLUSIVE) | (u2 & ISDN_USAGE_EXCLUSIVE));
isdn_slot_set_usage(i2, (u2 & ~ISDN_USAGE_EXCLUSIVE) | (u1 & ISDN_USAGE_EXCLUSIVE)); isdn_slot_set_usage(i2, (u2 & ~ISDN_USAGE_EXCLUSIVE) | (u1 & ISDN_USAGE_EXCLUSIVE));
} }
...@@ -2273,10 +2253,8 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup) ...@@ -2273,10 +2253,8 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
n = (isdn_net_phone *) 0; n = (isdn_net_phone *) 0;
p = dev->netdev; p = dev->netdev;
ematch = wret = swapped = 0; ematch = wret = swapped = 0;
#ifdef ISDN_DEBUG_NET_ICALL dbg_net_icall("n_fi: di=%d ch=%d idx=%d usg=%d\n", di, ch, idx,
printk(KERN_DEBUG "n_fi: di=%d ch=%d idx=%d usg=%d\n", di, ch, idx,
dev->usage[idx]); dev->usage[idx]);
#endif
while (p) { while (p) {
int matchret; int matchret;
isdn_net_local *lp = p->local; isdn_net_local *lp = p->local;
...@@ -2313,10 +2291,8 @@ p = dev->netdev; ...@@ -2313,10 +2291,8 @@ p = dev->netdev;
/* Remember if more numbers eventually can match */ /* Remember if more numbers eventually can match */
if (matchret > wret) if (matchret > wret)
wret = matchret; wret = matchret;
#ifdef ISDN_DEBUG_NET_ICALL dbg_net_icall("n_fi: if='%s', l.msn=%s, l.flags=%d, l.dstate=%d\n",
printk(KERN_DEBUG "n_fi: if='%s', l.msn=%s, l.flags=%d, l.dstate=%d\n",
lp->name, lp->msn, lp->flags, lp->dialstate); lp->name, lp->msn, lp->flags, lp->dialstate);
#endif
if ((!matchret) && /* EAZ is matching */ if ((!matchret) && /* EAZ is matching */
(((!(lp->flags & ISDN_NET_CONNECTED)) && /* but not connected */ (((!(lp->flags & ISDN_NET_CONNECTED)) && /* but not connected */
(USG_NONE(isdn_slot_usage(idx)))) || /* and ch. unused or */ (USG_NONE(isdn_slot_usage(idx)))) || /* and ch. unused or */
...@@ -2324,10 +2300,8 @@ p = dev->netdev; ...@@ -2324,10 +2300,8 @@ p = dev->netdev;
(!(lp->flags & ISDN_NET_CALLBACK))) /* but no callback */ (!(lp->flags & ISDN_NET_CALLBACK))) /* but no callback */
))) )))
{ {
#ifdef ISDN_DEBUG_NET_ICALL dbg_net_icall("n_fi: match1, pdev=%d pch=%d\n",
printk(KERN_DEBUG "n_fi: match1, pdev=%d pch=%d\n",
lp->pre_device, lp->pre_channel); lp->pre_device, lp->pre_channel);
#endif
if (isdn_slot_usage(idx) & ISDN_USAGE_EXCLUSIVE) { if (isdn_slot_usage(idx) & ISDN_USAGE_EXCLUSIVE) {
if ((lp->pre_channel != ch) || if ((lp->pre_channel != ch) ||
(lp->pre_device != di)) { (lp->pre_device != di)) {
...@@ -2342,16 +2316,12 @@ p = dev->netdev; ...@@ -2342,16 +2316,12 @@ p = dev->netdev;
*/ */
if (ch == 0) { if (ch == 0) {
sidx = isdn_dc2minor(di, 1); sidx = isdn_dc2minor(di, 1);
#ifdef ISDN_DEBUG_NET_ICALL dbg_net_icall("n_fi: ch is 0\n");
printk(KERN_DEBUG "n_fi: ch is 0\n");
#endif
if (USG_NONE(isdn_slot_usage(sidx))) { if (USG_NONE(isdn_slot_usage(sidx))) {
/* Second Channel is free, now see if it is bound /* Second Channel is free, now see if it is bound
* exclusive too. */ * exclusive too. */
if (isdn_slot_usage(sidx) & ISDN_USAGE_EXCLUSIVE) { if (isdn_slot_usage(sidx) & ISDN_USAGE_EXCLUSIVE) {
#ifdef ISDN_DEBUG_NET_ICALL dbg_net_icall("n_fi: 2nd channel is down and bound\n");
printk(KERN_DEBUG "n_fi: 2nd channel is down and bound\n");
#endif
/* Yes, swap bindings only, if the original /* Yes, swap bindings only, if the original
* binding is bound to channel 1 of this driver */ * binding is bound to channel 1 of this driver */
if ((lp->pre_device == di) && if ((lp->pre_device == di) &&
...@@ -2364,39 +2334,29 @@ p = dev->netdev; ...@@ -2364,39 +2334,29 @@ p = dev->netdev;
continue; continue;
} }
} else { } else {
#ifdef ISDN_DEBUG_NET_ICALL dbg_net_icall("n_fi: 2nd channel is down and unbound\n");
printk(KERN_DEBUG "n_fi: 2nd channel is down and unbound\n");
#endif
/* No, swap always and swap excl-usage also */ /* No, swap always and swap excl-usage also */
isdn_net_swap_usage(idx, sidx); isdn_net_swap_usage(idx, sidx);
isdn_net_swapbind(di); isdn_net_swapbind(di);
swapped = 2; swapped = 2;
} }
/* Now check for exclusive binding again */ /* Now check for exclusive binding again */
#ifdef ISDN_DEBUG_NET_ICALL dbg_net_icall("n_fi: final check\n");
printk(KERN_DEBUG "n_fi: final check\n");
#endif
if ((isdn_slot_usage(idx) & ISDN_USAGE_EXCLUSIVE) && if ((isdn_slot_usage(idx) & ISDN_USAGE_EXCLUSIVE) &&
((lp->pre_channel != ch) || ((lp->pre_channel != ch) ||
(lp->pre_device != di))) { (lp->pre_device != di))) {
#ifdef ISDN_DEBUG_NET_ICALL dbg_net_icall("n_fi: final check failed\n");
printk(KERN_DEBUG "n_fi: final check failed\n");
#endif
p = (isdn_net_dev *) p->next; p = (isdn_net_dev *) p->next;
continue; continue;
} }
} }
} else { } else {
/* We are already on the second channel, so nothing to do */ /* We are already on the second channel, so nothing to do */
#ifdef ISDN_DEBUG_NET_ICALL dbg_net_icall("n_fi: already on 2nd channel\n");
printk(KERN_DEBUG "n_fi: already on 2nd channel\n");
#endif
} }
} }
} }
#ifdef ISDN_DEBUG_NET_ICALL dbg_net_icall("n_fi: match2\n");
printk(KERN_DEBUG "n_fi: match2\n");
#endif
n = lp->phone[0]; n = lp->phone[0];
if (lp->flags & ISDN_NET_SECURE) { if (lp->flags & ISDN_NET_SECURE) {
while (n) { while (n) {
...@@ -2406,9 +2366,7 @@ p = dev->netdev; ...@@ -2406,9 +2366,7 @@ p = dev->netdev;
} }
} }
if (n || (!(lp->flags & ISDN_NET_SECURE))) { if (n || (!(lp->flags & ISDN_NET_SECURE))) {
#ifdef ISDN_DEBUG_NET_ICALL dbg_net_icall(KERN_DEBUG "n_fi: match3\n");
printk(KERN_DEBUG "n_fi: match3\n");
#endif
/* matching interface found */ /* matching interface found */
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment