Commit a05f676e authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Cleanup #ifdefs in isdn_common.c

Use a simple conditional #define in the header instead of spreading
#ifdef .. #endif all over the place.
parent 62720197
...@@ -27,18 +27,10 @@ ...@@ -27,18 +27,10 @@
#ifdef CONFIG_ISDN_AUDIO #ifdef CONFIG_ISDN_AUDIO
#include "isdn_audio.h" #include "isdn_audio.h"
#endif #endif
#ifdef CONFIG_ISDN_DIVERSION_MODULE
#define CONFIG_ISDN_DIVERSION
#endif
#ifdef CONFIG_ISDN_DIVERSION
#include <linux/isdn_divertif.h> #include <linux/isdn_divertif.h>
#endif /* CONFIG_ISDN_DIVERSION */
#include "isdn_v110.h" #include "isdn_v110.h"
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
/* Debugflags */
#undef ISDN_DEBUG_STATCALLB
MODULE_DESCRIPTION("ISDN4Linux: link layer"); MODULE_DESCRIPTION("ISDN4Linux: link layer");
MODULE_AUTHOR("Fritz Elfert"); MODULE_AUTHOR("Fritz Elfert");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -76,9 +68,11 @@ static char *isdn_audio_revision = ": none $"; ...@@ -76,9 +68,11 @@ static char *isdn_audio_revision = ": none $";
#endif #endif
extern char *isdn_v110_revision; extern char *isdn_v110_revision;
#ifdef CONFIG_ISDN_DIVERSION #if defined(CONFIG_ISDN_DIVERSION) || defined(CONFIG_ISDN_DIVERSION_MODULE)
static isdn_divert_if *divert_if; /* = NULL */ static isdn_divert_if *divert_if; /* = NULL */
#endif /* CONFIG_ISDN_DIVERSION */ #else
#define divert_if (0)
#endif
static void set_global_features(void); static void set_global_features(void);
...@@ -464,9 +458,7 @@ isdn_status_callback(isdn_ctrl * c) ...@@ -464,9 +458,7 @@ isdn_status_callback(isdn_ctrl * c)
case ISDN_STAT_ICALL: case ISDN_STAT_ICALL:
if (i < 0) if (i < 0)
return -1; return -1;
#ifdef ISDN_DEBUG_STATCALLB dbg_statcallb("ICALL: %d %ld %s\n", di, c->arg, c->parm.num);
printk(KERN_DEBUG "ICALL (net): %d %ld %s\n", di, c->arg, c->parm.num);
#endif
if (dev->global_flags & ISDN_GLOBAL_STOPPED) { if (dev->global_flags & ISDN_GLOBAL_STOPPED) {
cmd.driver = di; cmd.driver = di;
cmd.arg = c->arg; cmd.arg = c->arg;
...@@ -484,12 +476,10 @@ isdn_status_callback(isdn_ctrl * c) ...@@ -484,12 +476,10 @@ isdn_status_callback(isdn_ctrl * c)
* 3 on eventually match, if CID is longer. * 3 on eventually match, if CID is longer.
*/ */
if (c->command == ISDN_STAT_ICALL) if (c->command == ISDN_STAT_ICALL)
if ((retval = isdn_tty_find_icall(di, c->arg, &c->parm.setup))) return(retval); if ((retval = isdn_tty_find_icall(di, c->arg, &c->parm.setup))) return(retval);
#ifdef CONFIG_ISDN_DIVERSION
if (divert_if) if (divert_if)
if ((retval = divert_if->stat_callback(c))) if ((retval = divert_if->stat_callback(c)))
return(retval); /* processed */ return(retval); /* processed */
#endif /* CONFIG_ISDN_DIVERSION */
if ((!retval) && (dev->drv[di]->flags & DRV_FLAG_REJBUS)) { if ((!retval) && (dev->drv[di]->flags & DRV_FLAG_REJBUS)) {
/* No tty responding */ /* No tty responding */
cmd.driver = di; cmd.driver = di;
...@@ -533,17 +523,13 @@ isdn_status_callback(isdn_ctrl * c) ...@@ -533,17 +523,13 @@ isdn_status_callback(isdn_ctrl * c)
retval = 3; retval = 3;
break; break;
} }
#ifdef ISDN_DEBUG_STATCALLB dbg_statcallb("ICALL: ret=%d\n", retval);
printk(KERN_DEBUG "ICALL: ret=%d\n", retval);
#endif
return retval; return retval;
break; break;
case ISDN_STAT_CINF: case ISDN_STAT_CINF:
if (i < 0) if (i < 0)
return -1; return -1;
#ifdef ISDN_DEBUG_STATCALLB dbg_statcallb("CINF: %ld %s\n", c->arg, c->parm.num);
printk(KERN_DEBUG "CINF: %ld %s\n", c->arg, c->parm.num);
#endif
if (dev->global_flags & ISDN_GLOBAL_STOPPED) if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return 0; return 0;
if (strcmp(c->parm.num, "0")) if (strcmp(c->parm.num, "0"))
...@@ -551,33 +537,23 @@ isdn_status_callback(isdn_ctrl * c) ...@@ -551,33 +537,23 @@ isdn_status_callback(isdn_ctrl * c)
isdn_tty_stat_callback(i, c); isdn_tty_stat_callback(i, c);
break; break;
case ISDN_STAT_CAUSE: case ISDN_STAT_CAUSE:
#ifdef ISDN_DEBUG_STATCALLB dbg_statcallb("CAUSE: %ld %s\n", c->arg, c->parm.num);
printk(KERN_DEBUG "CAUSE: %ld %s\n", c->arg, c->parm.num);
#endif
printk(KERN_INFO "isdn: %s,ch%ld cause: %s\n", printk(KERN_INFO "isdn: %s,ch%ld cause: %s\n",
dev->drvid[di], c->arg, c->parm.num); dev->drvid[di], c->arg, c->parm.num);
isdn_tty_stat_callback(i, c); isdn_tty_stat_callback(i, c);
#ifdef CONFIG_ISDN_DIVERSION
if (divert_if) if (divert_if)
divert_if->stat_callback(c); divert_if->stat_callback(c);
#endif /* CONFIG_ISDN_DIVERSION */
break; break;
case ISDN_STAT_DISPLAY: case ISDN_STAT_DISPLAY:
#ifdef ISDN_DEBUG_STATCALLB dbg_statcallb("DISPLAY: %ld %s\n", c->arg, c->parm.display);
printk(KERN_DEBUG "DISPLAY: %ld %s\n", c->arg, c->parm.display);
#endif
isdn_tty_stat_callback(i, c); isdn_tty_stat_callback(i, c);
#ifdef CONFIG_ISDN_DIVERSION
if (divert_if) if (divert_if)
divert_if->stat_callback(c); divert_if->stat_callback(c);
#endif /* CONFIG_ISDN_DIVERSION */
break; break;
case ISDN_STAT_DCONN: case ISDN_STAT_DCONN:
if (i < 0) if (i < 0)
return -1; return -1;
#ifdef ISDN_DEBUG_STATCALLB dbg_statcallb("DCONN: %ld\n", c->arg);
printk(KERN_DEBUG "DCONN: %ld\n", c->arg);
#endif
if (dev->global_flags & ISDN_GLOBAL_STOPPED) if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return 0; return 0;
/* Find any net-device, waiting for D-channel setup */ /* Find any net-device, waiting for D-channel setup */
...@@ -596,9 +572,7 @@ isdn_status_callback(isdn_ctrl * c) ...@@ -596,9 +572,7 @@ isdn_status_callback(isdn_ctrl * c)
case ISDN_STAT_DHUP: case ISDN_STAT_DHUP:
if (i < 0) if (i < 0)
return -1; return -1;
#ifdef ISDN_DEBUG_STATCALLB dbg_statcallb("DHUP: %ld\n", c->arg);
printk(KERN_DEBUG "DHUP: %ld\n", c->arg);
#endif
if (dev->global_flags & ISDN_GLOBAL_STOPPED) if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return 0; return 0;
dev->drv[di]->online &= ~(1 << (c->arg)); dev->drv[di]->online &= ~(1 << (c->arg));
...@@ -609,18 +583,13 @@ isdn_status_callback(isdn_ctrl * c) ...@@ -609,18 +583,13 @@ isdn_status_callback(isdn_ctrl * c)
isdn_v110_stat_callback(&slot[i].iv110, c); isdn_v110_stat_callback(&slot[i].iv110, c);
if (isdn_tty_stat_callback(i, c)) if (isdn_tty_stat_callback(i, c))
break; break;
#ifdef CONFIG_ISDN_DIVERSION
if (divert_if) if (divert_if)
divert_if->stat_callback(c); divert_if->stat_callback(c);
#endif /* CONFIG_ISDN_DIVERSION */
break;
break; break;
case ISDN_STAT_BCONN: case ISDN_STAT_BCONN:
if (i < 0) if (i < 0)
return -1; return -1;
#ifdef ISDN_DEBUG_STATCALLB dbg_statcallb("BCONN: %ld\n", c->arg);
printk(KERN_DEBUG "BCONN: %ld\n", c->arg);
#endif
/* Signal B-channel-connect to network-devices */ /* Signal B-channel-connect to network-devices */
if (dev->global_flags & ISDN_GLOBAL_STOPPED) if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return 0; return 0;
...@@ -635,9 +604,7 @@ isdn_status_callback(isdn_ctrl * c) ...@@ -635,9 +604,7 @@ isdn_status_callback(isdn_ctrl * c)
case ISDN_STAT_BHUP: case ISDN_STAT_BHUP:
if (i < 0) if (i < 0)
return -1; return -1;
#ifdef ISDN_DEBUG_STATCALLB dbg_statcallb("BHUP: %ld\n", c->arg);
printk(KERN_DEBUG "BHUP: %ld\n", c->arg);
#endif
if (dev->global_flags & ISDN_GLOBAL_STOPPED) if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return 0; return 0;
dev->drv[di]->online &= ~(1 << (c->arg)); dev->drv[di]->online &= ~(1 << (c->arg));
...@@ -654,9 +621,7 @@ isdn_status_callback(isdn_ctrl * c) ...@@ -654,9 +621,7 @@ isdn_status_callback(isdn_ctrl * c)
case ISDN_STAT_NODCH: case ISDN_STAT_NODCH:
if (i < 0) if (i < 0)
return -1; return -1;
#ifdef ISDN_DEBUG_STATCALLB dbg_statcallb("NODCH: %ld\n", c->arg);
printk(KERN_DEBUG "NODCH: %ld\n", c->arg);
#endif
if (dev->global_flags & ISDN_GLOBAL_STOPPED) if (dev->global_flags & ISDN_GLOBAL_STOPPED)
return 0; return 0;
if (isdn_net_stat_callback(i, c)) if (isdn_net_stat_callback(i, c))
...@@ -733,12 +698,10 @@ isdn_status_callback(isdn_ctrl * c) ...@@ -733,12 +698,10 @@ isdn_status_callback(isdn_ctrl * c)
isdn_tty_stat_callback(i, c); isdn_tty_stat_callback(i, c);
break; break;
#endif #endif
#ifdef CONFIG_ISDN_DIVERSION
case ISDN_STAT_PROT: case ISDN_STAT_PROT:
case ISDN_STAT_REDIR: case ISDN_STAT_REDIR:
if (divert_if) if (divert_if)
return(divert_if->stat_callback(c)); return(divert_if->stat_callback(c));
#endif /* CONFIG_ISDN_DIVERSION */
default: default:
return -1; return -1;
} }
...@@ -1987,7 +1950,7 @@ set_global_features(void) ...@@ -1987,7 +1950,7 @@ set_global_features(void)
} }
} }
#ifdef CONFIG_ISDN_DIVERSION #if defined(CONFIG_ISDN_DIVERSION) || defined(CONFIG_ISDN_DIVERSION_MODULE)
static char *map_drvname(int di) static char *map_drvname(int di)
{ {
...@@ -2036,7 +1999,7 @@ int DIVERT_REG_NAME(isdn_divert_if *i_div) ...@@ -2036,7 +1999,7 @@ int DIVERT_REG_NAME(isdn_divert_if *i_div)
EXPORT_SYMBOL(DIVERT_REG_NAME); EXPORT_SYMBOL(DIVERT_REG_NAME);
#endif /* CONFIG_ISDN_DIVERSION */ #endif
EXPORT_SYMBOL(register_isdn); EXPORT_SYMBOL(register_isdn);
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#undef ISDN_DEBUG_NET_DUMP #undef ISDN_DEBUG_NET_DUMP
#undef ISDN_DEBUG_NET_DIAL #undef ISDN_DEBUG_NET_DIAL
#undef ISDN_DEBUG_NET_ICALL #undef ISDN_DEBUG_NET_ICALL
#undef ISDN_DEBUG_STATCALLB
#ifdef ISDN_DEBUG_NET_DIAL #ifdef ISDN_DEBUG_NET_DIAL
#define dbg_net_dial(arg...) printk(KERN_DEBUG arg) #define dbg_net_dial(arg...) printk(KERN_DEBUG arg)
...@@ -36,6 +37,12 @@ ...@@ -36,6 +37,12 @@
#define dbg_net_icall(arg...) do {} while (0) #define dbg_net_icall(arg...) do {} while (0)
#endif #endif
#ifdef ISDN_DEBUG_STATCALLB
#define dbg_statcallb(arg...) printk(KERN_DEBUG arg)
#else
#define dbg_statcallb(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)
......
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