summaryrefslogtreecommitdiff
path: root/drivers/isdn/i4l/isdn_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/i4l/isdn_common.c')
-rw-r--r--drivers/isdn/i4l/isdn_common.c1502
1 files changed, 751 insertions, 751 deletions
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index 6ddb795e..d9f5524 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -111,7 +111,7 @@ isdn_unlock_drivers(void)
#if defined(ISDN_DEBUG_NET_DUMP) || defined(ISDN_DEBUG_MODEM_DUMP)
void
-isdn_dumppkt(char *s, u_char * p, int len, int dumplen)
+isdn_dumppkt(char *s, u_char *p, int len, int dumplen)
{
int dumpc;
@@ -163,58 +163,58 @@ isdn_wildmat(char *s, char *p)
register int nostar = 1;
if (!(*s) && !(*p))
- return(1);
+ return (1);
for (; *p; s++, p++)
switch (*p) {
- case '\\':
- /*
- * Literal match with following character,
- * fall through.
- */
+ case '\\':
+ /*
+ * Literal match with following character,
+ * fall through.
+ */
+ p++;
+ default:
+ if (*s != *p)
+ return (*s == '\0') ? 2 : 1;
+ continue;
+ case '?':
+ /* Match anything. */
+ if (*s == '\0')
+ return (2);
+ continue;
+ case '*':
+ nostar = 0;
+ /* Trailing star matches everything. */
+ return (*++p ? isdn_star(s, p) : 0);
+ case '[':
+ /* [^....] means inverse character class. */
+ if ((reverse = (p[1] == '^')))
p++;
- default:
- if (*s != *p)
- return (*s == '\0')?2:1;
- continue;
- case '?':
- /* Match anything. */
- if (*s == '\0')
- return (2);
- continue;
- case '*':
- nostar = 0;
- /* Trailing star matches everything. */
- return (*++p ? isdn_star(s, p) : 0);
- case '[':
- /* [^....] means inverse character class. */
- if ((reverse = (p[1] == '^')))
- p++;
- for (last = 0, matched = 0; *++p && (*p != ']'); last = *p)
- /* This next line requires a good C compiler. */
- if (*p == '-' ? *s <= *++p && *s >= last : *s == *p)
- matched = 1;
- if (matched == reverse)
- return (1);
- continue;
+ for (last = 0, matched = 0; *++p && (*p != ']'); last = *p)
+ /* This next line requires a good C compiler. */
+ if (*p == '-' ? *s <= *++p && *s >= last : *s == *p)
+ matched = 1;
+ if (matched == reverse)
+ return (1);
+ continue;
}
- return (*s == '\0')?0:nostar;
+ return (*s == '\0') ? 0 : nostar;
}
-int isdn_msncmp( const char * msn1, const char * msn2 )
+int isdn_msncmp(const char *msn1, const char *msn2)
{
- char TmpMsn1[ ISDN_MSNLEN ];
- char TmpMsn2[ ISDN_MSNLEN ];
+ char TmpMsn1[ISDN_MSNLEN];
+ char TmpMsn2[ISDN_MSNLEN];
char *p;
- for ( p = TmpMsn1; *msn1 && *msn1 != ':'; ) // Strip off a SPID
+ for (p = TmpMsn1; *msn1 && *msn1 != ':';) // Strip off a SPID
*p++ = *msn1++;
*p = '\0';
- for ( p = TmpMsn2; *msn2 && *msn2 != ':'; ) // Strip off a SPID
+ for (p = TmpMsn2; *msn2 && *msn2 != ':';) // Strip off a SPID
*p++ = *msn2++;
*p = '\0';
- return isdn_wildmat( TmpMsn1, TmpMsn2 );
+ return isdn_wildmat(TmpMsn1, TmpMsn2);
}
int
@@ -262,8 +262,8 @@ isdn_timer_funct(ulong dummy)
isdn_tty_carrier_timeout();
}
}
- if (tf)
- mod_timer(&dev->timer, jiffies+ISDN_TIMER_RES);
+ if (tf)
+ mod_timer(&dev->timer, jiffies + ISDN_TIMER_RES);
}
void
@@ -284,7 +284,7 @@ isdn_timer_ctrl(int tf, int onoff)
else
dev->tflags &= ~tf;
if (dev->tflags && !old_tflags)
- mod_timer(&dev->timer, jiffies+ISDN_TIMER_RES);
+ mod_timer(&dev->timer, jiffies + ISDN_TIMER_RES);
spin_unlock_irqrestore(&dev->timerlock, flags);
}
@@ -302,7 +302,7 @@ isdn_receive_skb_callback(int di, int channel, struct sk_buff *skb)
}
/* Update statistics */
dev->ibytes[i] += skb->len;
-
+
/* First, try to deliver data to network-device */
if (isdn_net_rcv_skb(i, skb))
return;
@@ -339,40 +339,40 @@ isdn_command(isdn_ctrl *cmd)
{
if (cmd->driver == -1) {
printk(KERN_WARNING "isdn_command command(%x) driver -1\n", cmd->command);
- return(1);
+ return (1);
}
if (!dev->drv[cmd->driver]) {
printk(KERN_WARNING "isdn_command command(%x) dev->drv[%d] NULL\n",
- cmd->command, cmd->driver);
- return(1);
+ cmd->command, cmd->driver);
+ return (1);
}
if (!dev->drv[cmd->driver]->interface) {
printk(KERN_WARNING "isdn_command command(%x) dev->drv[%d]->interface NULL\n",
- cmd->command, cmd->driver);
- return(1);
+ cmd->command, cmd->driver);
+ return (1);
}
if (cmd->command == ISDN_CMD_SETL2) {
int idx = isdn_dc2minor(cmd->driver, cmd->arg & 255);
unsigned long l2prot = (cmd->arg >> 8) & 255;
unsigned long features = (dev->drv[cmd->driver]->interface->features
- >> ISDN_FEATURE_L2_SHIFT) &
- ISDN_FEATURE_L2_MASK;
+ >> ISDN_FEATURE_L2_SHIFT) &
+ ISDN_FEATURE_L2_MASK;
unsigned long l2_feature = (1 << l2prot);
switch (l2prot) {
- case ISDN_PROTO_L2_V11096:
- case ISDN_PROTO_L2_V11019:
- case ISDN_PROTO_L2_V11038:
+ case ISDN_PROTO_L2_V11096:
+ case ISDN_PROTO_L2_V11019:
+ case ISDN_PROTO_L2_V11038:
/* If V.110 requested, but not supported by
* HL-driver, set emulator-flag and change
* Layer-2 to transparent
*/
- if (!(features & l2_feature)) {
- dev->v110emu[idx] = l2prot;
- cmd->arg = (cmd->arg & 255) |
- (ISDN_PROTO_L2_TRANS << 8);
- } else
- dev->v110emu[idx] = 0;
+ if (!(features & l2_feature)) {
+ dev->v110emu[idx] = l2prot;
+ cmd->arg = (cmd->arg & 255) |
+ (ISDN_PROTO_L2_TRANS << 8);
+ } else
+ dev->v110emu[idx] = 0;
}
}
return dev->drv[cmd->driver]->interface->command(cmd);
@@ -393,7 +393,7 @@ isdn_all_eaz(int di, int ch)
}
/*
- * Begin of a CAPI like LL<->HL interface, currently used only for
+ * Begin of a CAPI like LL<->HL interface, currently used only for
* supplementary service (CAPI 2.0 part III)
*/
#include <linux/isdn/capicmd.h>
@@ -401,17 +401,17 @@ isdn_all_eaz(int di, int ch)
static int
isdn_capi_rec_hl_msg(capi_msg *cm)
{
- switch(cm->Command) {
- case CAPI_FACILITY:
- /* in the moment only handled in tty */
- return(isdn_tty_capi_facility(cm));
- default:
- return(-1);
+ switch (cm->Command) {
+ case CAPI_FACILITY:
+ /* in the moment only handled in tty */
+ return (isdn_tty_capi_facility(cm));
+ default:
+ return (-1);
}
}
static int
-isdn_status_callback(isdn_ctrl * c)
+isdn_status_callback(isdn_ctrl *c)
{
int di;
u_long flags;
@@ -424,314 +424,314 @@ isdn_status_callback(isdn_ctrl * c)
di = c->driver;
i = isdn_dc2minor(di, c->arg);
switch (c->command) {
- case ISDN_STAT_BSENT:
- if (i < 0)
- return -1;
- if (dev->global_flags & ISDN_GLOBAL_STOPPED)
- return 0;
- if (isdn_net_stat_callback(i, c))
- return 0;
- if (isdn_v110_stat_callback(i, c))
- return 0;
- if (isdn_tty_stat_callback(i, c))
- return 0;
- wake_up_interruptible(&dev->drv[di]->snd_waitq[c->arg]);
- break;
- case ISDN_STAT_STAVAIL:
- dev->drv[di]->stavail += c->arg;
- wake_up_interruptible(&dev->drv[di]->st_waitq);
- break;
- case ISDN_STAT_RUN:
- dev->drv[di]->flags |= DRV_FLAG_RUNNING;
- for (i = 0; i < ISDN_MAX_CHANNELS; i++)
- if (dev->drvmap[i] == di)
- isdn_all_eaz(di, dev->chanmap[i]);
- set_global_features();
- break;
- case ISDN_STAT_STOP:
- dev->drv[di]->flags &= ~DRV_FLAG_RUNNING;
- break;
- case ISDN_STAT_ICALL:
- if (i < 0)
- return -1;
+ case ISDN_STAT_BSENT:
+ if (i < 0)
+ return -1;
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED)
+ return 0;
+ if (isdn_net_stat_callback(i, c))
+ return 0;
+ if (isdn_v110_stat_callback(i, c))
+ return 0;
+ if (isdn_tty_stat_callback(i, c))
+ return 0;
+ wake_up_interruptible(&dev->drv[di]->snd_waitq[c->arg]);
+ break;
+ case ISDN_STAT_STAVAIL:
+ dev->drv[di]->stavail += c->arg;
+ wake_up_interruptible(&dev->drv[di]->st_waitq);
+ break;
+ case ISDN_STAT_RUN:
+ dev->drv[di]->flags |= DRV_FLAG_RUNNING;
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++)
+ if (dev->drvmap[i] == di)
+ isdn_all_eaz(di, dev->chanmap[i]);
+ set_global_features();
+ break;
+ case ISDN_STAT_STOP:
+ dev->drv[di]->flags &= ~DRV_FLAG_RUNNING;
+ break;
+ case ISDN_STAT_ICALL:
+ if (i < 0)
+ return -1;
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "ICALL (net): %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.arg = c->arg;
+ cmd.command = ISDN_CMD_HANGUP;
+ isdn_command(&cmd);
+ return 0;
+ }
+ /* Try to find a network-interface which will accept incoming call */
+ r = ((c->command == ISDN_STAT_ICALLW) ? 0 : isdn_net_find_icall(di, c->arg, i, &c->parm.setup));
+ switch (r) {
+ case 0:
+ /* No network-device replies.
+ * Try ttyI's.
+ * These return 0 on no match, 1 on match and
+ * 3 on eventually match, if CID is longer.
+ */
+ if (c->command == ISDN_STAT_ICALL)
+ if ((retval = isdn_tty_find_icall(di, c->arg, &c->parm.setup))) return (retval);
+#ifdef CONFIG_ISDN_DIVERSION
+ if (divert_if)
+ if ((retval = divert_if->stat_callback(c)))
+ return (retval); /* processed */
+#endif /* CONFIG_ISDN_DIVERSION */
+ if ((!retval) && (dev->drv[di]->flags & DRV_FLAG_REJBUS)) {
+ /* No tty responding */
cmd.driver = di;
cmd.arg = c->arg;
cmd.command = ISDN_CMD_HANGUP;
isdn_command(&cmd);
- return 0;
+ retval = 2;
}
- /* Try to find a network-interface which will accept incoming call */
- r = ((c->command == ISDN_STAT_ICALLW) ? 0 : isdn_net_find_icall(di, c->arg, i, &c->parm.setup));
- switch (r) {
- case 0:
- /* No network-device replies.
- * Try ttyI's.
- * These return 0 on no match, 1 on match and
- * 3 on eventually match, if CID is longer.
- */
- if (c->command == ISDN_STAT_ICALL)
- if ((retval = isdn_tty_find_icall(di, c->arg, &c->parm.setup))) return(retval);
-#ifdef CONFIG_ISDN_DIVERSION
- if (divert_if)
- if ((retval = divert_if->stat_callback(c)))
- return(retval); /* processed */
-#endif /* CONFIG_ISDN_DIVERSION */
- if ((!retval) && (dev->drv[di]->flags & DRV_FLAG_REJBUS)) {
- /* No tty responding */
- cmd.driver = di;
- cmd.arg = c->arg;
- cmd.command = ISDN_CMD_HANGUP;
- isdn_command(&cmd);
- retval = 2;
- }
- break;
- case 1:
- /* Schedule connection-setup */
- isdn_net_dial();
- cmd.driver = di;
- cmd.arg = c->arg;
- cmd.command = ISDN_CMD_ACCEPTD;
- for ( p = dev->netdev; p; p = p->next )
- if ( p->local->isdn_channel == cmd.arg )
- {
- strcpy( cmd.parm.setup.eazmsn, p->local->msn );
- isdn_command(&cmd);
- retval = 1;
- break;
- }
- break;
-
- case 2: /* For calling back, first reject incoming call ... */
- case 3: /* Interface found, but down, reject call actively */
- retval = 2;
- printk(KERN_INFO "isdn: Rejecting Call\n");
- cmd.driver = di;
- cmd.arg = c->arg;
- cmd.command = ISDN_CMD_HANGUP;
+ break;
+ case 1:
+ /* Schedule connection-setup */
+ isdn_net_dial();
+ cmd.driver = di;
+ cmd.arg = c->arg;
+ cmd.command = ISDN_CMD_ACCEPTD;
+ for (p = dev->netdev; p; p = p->next)
+ if (p->local->isdn_channel == cmd.arg)
+ {
+ strcpy(cmd.parm.setup.eazmsn, p->local->msn);
isdn_command(&cmd);
- if (r == 3)
- break;
- /* Fall through */
- case 4:
- /* ... then start callback. */
- isdn_net_dial();
- break;
- case 5:
- /* Number would eventually match, if longer */
- retval = 3;
+ retval = 1;
break;
- }
+ }
+ break;
+
+ case 2: /* For calling back, first reject incoming call ... */
+ case 3: /* Interface found, but down, reject call actively */
+ retval = 2;
+ printk(KERN_INFO "isdn: Rejecting Call\n");
+ cmd.driver = di;
+ cmd.arg = c->arg;
+ cmd.command = ISDN_CMD_HANGUP;
+ isdn_command(&cmd);
+ if (r == 3)
+ break;
+ /* Fall through */
+ case 4:
+ /* ... then start callback. */
+ isdn_net_dial();
+ break;
+ case 5:
+ /* Number would eventually match, if longer */
+ retval = 3;
+ break;
+ }
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "ICALL: ret=%d\n", retval);
+ printk(KERN_DEBUG "ICALL: ret=%d\n", retval);
#endif
- return retval;
- break;
- case ISDN_STAT_CINF:
- if (i < 0)
- return -1;
+ return retval;
+ break;
+ case ISDN_STAT_CINF:
+ if (i < 0)
+ return -1;
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "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)
- return 0;
- if (strcmp(c->parm.num, "0"))
- isdn_net_stat_callback(i, c);
- isdn_tty_stat_callback(i, c);
- break;
- case ISDN_STAT_CAUSE:
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED)
+ return 0;
+ if (strcmp(c->parm.num, "0"))
+ isdn_net_stat_callback(i, c);
+ isdn_tty_stat_callback(i, c);
+ break;
+ case ISDN_STAT_CAUSE:
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "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",
- dev->drvid[di], c->arg, c->parm.num);
- isdn_tty_stat_callback(i, c);
+ printk(KERN_INFO "isdn: %s,ch%ld cause: %s\n",
+ dev->drvid[di], c->arg, c->parm.num);
+ isdn_tty_stat_callback(i, c);
#ifdef CONFIG_ISDN_DIVERSION
- if (divert_if)
- divert_if->stat_callback(c);
+ if (divert_if)
+ divert_if->stat_callback(c);
#endif /* CONFIG_ISDN_DIVERSION */
- break;
- case ISDN_STAT_DISPLAY:
+ break;
+ case ISDN_STAT_DISPLAY:
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "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)
- divert_if->stat_callback(c);
+ if (divert_if)
+ divert_if->stat_callback(c);
#endif /* CONFIG_ISDN_DIVERSION */
- break;
- case ISDN_STAT_DCONN:
- if (i < 0)
- return -1;
+ break;
+ case ISDN_STAT_DCONN:
+ if (i < 0)
+ return -1;
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "DCONN: %ld\n", c->arg);
+ printk(KERN_DEBUG "DCONN: %ld\n", c->arg);
#endif
- if (dev->global_flags & ISDN_GLOBAL_STOPPED)
- return 0;
- /* Find any net-device, waiting for D-channel setup */
- if (isdn_net_stat_callback(i, c))
- break;
- isdn_v110_stat_callback(i, c);
- /* Find any ttyI, waiting for D-channel setup */
- if (isdn_tty_stat_callback(i, c)) {
- cmd.driver = di;
- cmd.arg = c->arg;
- cmd.command = ISDN_CMD_ACCEPTB;
- isdn_command(&cmd);
- break;
- }
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED)
+ return 0;
+ /* Find any net-device, waiting for D-channel setup */
+ if (isdn_net_stat_callback(i, c))
break;
- case ISDN_STAT_DHUP:
- if (i < 0)
- return -1;
+ isdn_v110_stat_callback(i, c);
+ /* Find any ttyI, waiting for D-channel setup */
+ if (isdn_tty_stat_callback(i, c)) {
+ cmd.driver = di;
+ cmd.arg = c->arg;
+ cmd.command = ISDN_CMD_ACCEPTB;
+ isdn_command(&cmd);
+ break;
+ }
+ break;
+ case ISDN_STAT_DHUP:
+ if (i < 0)
+ return -1;
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "DHUP: %ld\n", c->arg);
+ printk(KERN_DEBUG "DHUP: %ld\n", c->arg);
#endif
- if (dev->global_flags & ISDN_GLOBAL_STOPPED)
- return 0;
- dev->drv[di]->online &= ~(1 << (c->arg));
- isdn_info_update();
- /* Signal hangup to network-devices */
- if (isdn_net_stat_callback(i, c))
- break;
- isdn_v110_stat_callback(i, c);
- if (isdn_tty_stat_callback(i, c))
- break;
-#ifdef CONFIG_ISDN_DIVERSION
- if (divert_if)
- divert_if->stat_callback(c);
-#endif /* CONFIG_ISDN_DIVERSION */
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED)
+ return 0;
+ dev->drv[di]->online &= ~(1 << (c->arg));
+ isdn_info_update();
+ /* Signal hangup to network-devices */
+ if (isdn_net_stat_callback(i, c))
break;
+ isdn_v110_stat_callback(i, c);
+ if (isdn_tty_stat_callback(i, c))
break;
- case ISDN_STAT_BCONN:
- if (i < 0)
- return -1;
+#ifdef CONFIG_ISDN_DIVERSION
+ if (divert_if)
+ divert_if->stat_callback(c);
+#endif /* CONFIG_ISDN_DIVERSION */
+ break;
+ break;
+ case ISDN_STAT_BCONN:
+ if (i < 0)
+ return -1;
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "BCONN: %ld\n", c->arg);
+ printk(KERN_DEBUG "BCONN: %ld\n", c->arg);
#endif
- /* Signal B-channel-connect to network-devices */
- if (dev->global_flags & ISDN_GLOBAL_STOPPED)
- return 0;
- dev->drv[di]->online |= (1 << (c->arg));
- isdn_info_update();
- if (isdn_net_stat_callback(i, c))
- break;
- isdn_v110_stat_callback(i, c);
- if (isdn_tty_stat_callback(i, c))
- break;
+ /* Signal B-channel-connect to network-devices */
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED)
+ return 0;
+ dev->drv[di]->online |= (1 << (c->arg));
+ isdn_info_update();
+ if (isdn_net_stat_callback(i, c))
+ break;
+ isdn_v110_stat_callback(i, c);
+ if (isdn_tty_stat_callback(i, c))
break;
- case ISDN_STAT_BHUP:
- if (i < 0)
- return -1;
+ break;
+ case ISDN_STAT_BHUP:
+ if (i < 0)
+ return -1;
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "BHUP: %ld\n", c->arg);
+ printk(KERN_DEBUG "BHUP: %ld\n", c->arg);
#endif
- if (dev->global_flags & ISDN_GLOBAL_STOPPED)
- return 0;
- dev->drv[di]->online &= ~(1 << (c->arg));
- isdn_info_update();
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED)
+ return 0;
+ dev->drv[di]->online &= ~(1 << (c->arg));
+ isdn_info_update();
#ifdef CONFIG_ISDN_X25
- /* Signal hangup to network-devices */
- if (isdn_net_stat_callback(i, c))
- break;
+ /* Signal hangup to network-devices */
+ if (isdn_net_stat_callback(i, c))
+ break;
#endif
- isdn_v110_stat_callback(i, c);
- if (isdn_tty_stat_callback(i, c))
- break;
+ isdn_v110_stat_callback(i, c);
+ if (isdn_tty_stat_callback(i, c))
break;
- case ISDN_STAT_NODCH:
- if (i < 0)
- return -1;
+ break;
+ case ISDN_STAT_NODCH:
+ if (i < 0)
+ return -1;
#ifdef ISDN_DEBUG_STATCALLB
- printk(KERN_DEBUG "NODCH: %ld\n", c->arg);
+ printk(KERN_DEBUG "NODCH: %ld\n", c->arg);
#endif
- if (dev->global_flags & ISDN_GLOBAL_STOPPED)
- return 0;
- if (isdn_net_stat_callback(i, c))
- break;
- if (isdn_tty_stat_callback(i, c))
- break;
+ if (dev->global_flags & ISDN_GLOBAL_STOPPED)
+ return 0;
+ if (isdn_net_stat_callback(i, c))
break;
- case ISDN_STAT_ADDCH:
- spin_lock_irqsave(&dev->lock, flags);
- if (isdn_add_channels(dev->drv[di], di, c->arg, 1)) {
- spin_unlock_irqrestore(&dev->lock, flags);
- return -1;
- }
- spin_unlock_irqrestore(&dev->lock, flags);
- isdn_info_update();
+ if (isdn_tty_stat_callback(i, c))
break;
- case ISDN_STAT_DISCH:
- spin_lock_irqsave(&dev->lock, flags);
- for (i = 0; i < ISDN_MAX_CHANNELS; i++)
- if ((dev->drvmap[i] == di) &&
- (dev->chanmap[i] == c->arg)) {
- if (c->parm.num[0])
- dev->usage[i] &= ~ISDN_USAGE_DISABLED;
- else
- if (USG_NONE(dev->usage[i])) {
- dev->usage[i] |= ISDN_USAGE_DISABLED;
- }
- else
- retval = -1;
- break;
- }
+ break;
+ case ISDN_STAT_ADDCH:
+ spin_lock_irqsave(&dev->lock, flags);
+ if (isdn_add_channels(dev->drv[di], di, c->arg, 1)) {
spin_unlock_irqrestore(&dev->lock, flags);
- isdn_info_update();
- break;
- case ISDN_STAT_UNLOAD:
- while (dev->drv[di]->locks > 0) {
- isdn_unlock_driver(dev->drv[di]);
- }
- spin_lock_irqsave(&dev->lock, flags);
- isdn_tty_stat_callback(i, c);
- for (i = 0; i < ISDN_MAX_CHANNELS; i++)
- if (dev->drvmap[i] == di) {
- dev->drvmap[i] = -1;
- dev->chanmap[i] = -1;
+ return -1;
+ }
+ spin_unlock_irqrestore(&dev->lock, flags);
+ isdn_info_update();
+ break;
+ case ISDN_STAT_DISCH:
+ spin_lock_irqsave(&dev->lock, flags);
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++)
+ if ((dev->drvmap[i] == di) &&
+ (dev->chanmap[i] == c->arg)) {
+ if (c->parm.num[0])
dev->usage[i] &= ~ISDN_USAGE_DISABLED;
- }
- dev->drivers--;
- dev->channels -= dev->drv[di]->channels;
- kfree(dev->drv[di]->rcverr);
- kfree(dev->drv[di]->rcvcount);
- for (i = 0; i < dev->drv[di]->channels; i++)
- skb_queue_purge(&dev->drv[di]->rpqueue[i]);
- kfree(dev->drv[di]->rpqueue);
- kfree(dev->drv[di]->rcv_waitq);
- kfree(dev->drv[di]);
- dev->drv[di] = NULL;
- dev->drvid[di][0] = '\0';
- isdn_info_update();
- set_global_features();
- spin_unlock_irqrestore(&dev->lock, flags);
- return 0;
- case ISDN_STAT_L1ERR:
- break;
- case CAPI_PUT_MESSAGE:
- return(isdn_capi_rec_hl_msg(&c->parm.cmsg));
+ else
+ if (USG_NONE(dev->usage[i])) {
+ dev->usage[i] |= ISDN_USAGE_DISABLED;
+ }
+ else
+ retval = -1;
+ break;
+ }
+ spin_unlock_irqrestore(&dev->lock, flags);
+ isdn_info_update();
+ break;
+ case ISDN_STAT_UNLOAD:
+ while (dev->drv[di]->locks > 0) {
+ isdn_unlock_driver(dev->drv[di]);
+ }
+ spin_lock_irqsave(&dev->lock, flags);
+ isdn_tty_stat_callback(i, c);
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++)
+ if (dev->drvmap[i] == di) {
+ dev->drvmap[i] = -1;
+ dev->chanmap[i] = -1;
+ dev->usage[i] &= ~ISDN_USAGE_DISABLED;
+ }
+ dev->drivers--;
+ dev->channels -= dev->drv[di]->channels;
+ kfree(dev->drv[di]->rcverr);
+ kfree(dev->drv[di]->rcvcount);
+ for (i = 0; i < dev->drv[di]->channels; i++)
+ skb_queue_purge(&dev->drv[di]->rpqueue[i]);
+ kfree(dev->drv[di]->rpqueue);
+ kfree(dev->drv[di]->rcv_waitq);
+ kfree(dev->drv[di]);
+ dev->drv[di] = NULL;
+ dev->drvid[di][0] = '\0';
+ isdn_info_update();
+ set_global_features();
+ spin_unlock_irqrestore(&dev->lock, flags);
+ return 0;
+ case ISDN_STAT_L1ERR:
+ break;
+ case CAPI_PUT_MESSAGE:
+ return (isdn_capi_rec_hl_msg(&c->parm.cmsg));
#ifdef CONFIG_ISDN_TTY_FAX
- case ISDN_STAT_FAXIND:
- isdn_tty_stat_callback(i, c);
- break;
+ case ISDN_STAT_FAXIND:
+ isdn_tty_stat_callback(i, c);
+ break;
#endif
#ifdef CONFIG_ISDN_AUDIO
- case ISDN_STAT_AUDIO:
- isdn_tty_stat_callback(i, c);
- break;
+ case ISDN_STAT_AUDIO:
+ isdn_tty_stat_callback(i, c);
+ break;
#endif
#ifdef CONFIG_ISDN_DIVERSION
- case ISDN_STAT_PROT:
- case ISDN_STAT_REDIR:
- if (divert_if)
- return(divert_if->stat_callback(c));
+ case ISDN_STAT_PROT:
+ case ISDN_STAT_REDIR:
+ if (divert_if)
+ return (divert_if->stat_callback(c));
#endif /* CONFIG_ISDN_DIVERSION */
- default:
- return -1;
+ default:
+ return -1;
}
return 0;
}
@@ -755,17 +755,17 @@ isdn_getnum(char **p)
* isdn_readbchan() tries to get data from the read-queue.
* It MUST be called with interrupts off.
*
- * Be aware that this is not an atomic operation when sleep != 0, even though
+ * Be aware that this is not an atomic operation when sleep != 0, even though
* interrupts are turned off! Well, like that we are currently only called
* on behalf of a read system call on raw device files (which are documented
* to be dangerous and for debugging purpose only). The inode semaphore
* takes care that this is not called for the same minor device number while
* we are sleeping, but access is not serialized against simultaneous read()
* from the corresponding ttyI device. Can other ugly events, like changes
- * of the mapping (di,ch)<->minor, happen during the sleep? --he
+ * of the mapping (di,ch)<->minor, happen during the sleep? --he
*/
int
-isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, wait_queue_head_t *sleep)
+isdn_readbchan(int di, int channel, u_char *buf, u_char *fp, int len, wait_queue_head_t *sleep)
{
int count;
int count_pull;
@@ -890,10 +890,10 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
if (!dev->drv[di])
return 0;
if (skb_queue_empty(&dev->drv[di]->rpqueue[channel]))
- return 0;
+ return 0;
len = tty_buffer_request_room(tty, dev->drv[di]->rcvcount[channel]);
- if(len == 0)
+ if (len == 0)
return len;
count = 0;
@@ -912,7 +912,7 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
count_pull = count_put = 0;
while ((count_pull < skb->len) && (len > 0)) {
/* push every character but the last to the tty buffer directly */
- if ( count_put )
+ if (count_put)
tty_insert_flip_char(tty, last, TTY_NORMAL);
len--;
if (dev->drv[di]->DLEflag & DLEmask) {
@@ -940,7 +940,7 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
dflag = 0;
}
count_put = count_pull;
- if(count_put > 1)
+ if (count_put > 1)
tty_insert_flip_string(tty, skb->data, count_put - 1);
last = skb->data[count_put - 1];
len -= count_put;
@@ -952,7 +952,7 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
/* We got all the data in this buff.
* Now we can dequeue it.
*/
- if(cisco_hack)
+ if (cisco_hack)
tty_insert_flip_char(tty, last, 0xFF);
else
tty_insert_flip_char(tty, last, TTY_NORMAL);
@@ -1057,7 +1057,7 @@ isdn_info_update(void)
}
static ssize_t
-isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
+isdn_read(struct file *file, char __user *buf, size_t count, loff_t *off)
{
uint minor = iminor(file->f_path.dentry->d_inode);
int len = 0;
@@ -1112,7 +1112,7 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
len = isdn_readbchan(drvidx, chidx, p, NULL, count,
&dev->drv[drvidx]->rcv_waitq[chidx]);
*off += len;
- if (copy_to_user(buf,p,len))
+ if (copy_to_user(buf, p, len))
len = -EFAULT;
kfree(p);
retval = len;
@@ -1135,7 +1135,7 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
if (count > dev->drv[drvidx]->stavail)
count = dev->drv[drvidx]->stavail;
len = dev->drv[drvidx]->interface->readstat(buf, count,
- drvidx, isdn_minor2chan(minor - ISDN_MINOR_CTRL));
+ drvidx, isdn_minor2chan(minor - ISDN_MINOR_CTRL));
if (len < 0) {
retval = len;
goto out;
@@ -1158,13 +1158,13 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
}
#endif
retval = -ENODEV;
- out:
+out:
mutex_unlock(&isdn_mutex);
return retval;
}
static ssize_t
-isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off)
+isdn_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
{
uint minor = iminor(file->f_path.dentry->d_inode);
int drvidx;
@@ -1204,11 +1204,11 @@ isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off
*
if (!(dev->drv[drvidx]->flags & DRV_FLAG_RUNNING))
return -ENODEV;
- */
+ */
if (dev->drv[drvidx]->interface->writecmd)
retval = dev->drv[drvidx]->interface->
writecmd(buf, count, drvidx,
- isdn_minor2chan(minor - ISDN_MINOR_CTRL));
+ isdn_minor2chan(minor - ISDN_MINOR_CTRL));
else
retval = count;
goto out;
@@ -1220,13 +1220,13 @@ isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off
}
#endif
retval = -ENODEV;
- out:
+out:
mutex_unlock(&isdn_mutex);
return retval;
}
static unsigned int
-isdn_poll(struct file *file, poll_table * wait)
+isdn_poll(struct file *file, poll_table *wait)
{
unsigned int mask = 0;
unsigned int minor = iminor(file->f_path.dentry->d_inode);
@@ -1261,7 +1261,7 @@ isdn_poll(struct file *file, poll_table * wait)
}
#endif
mask = POLLERR;
- out:
+out:
mutex_unlock(&isdn_mutex);
return mask;
}
@@ -1294,38 +1294,38 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
if (minor == ISDN_MINOR_STATUS) {
switch (cmd) {
- case IIOCGETDVR:
- return (TTY_DV +
- (NET_DV << 8) +
- (INF_DV << 16));
- case IIOCGETCPS:
- if (arg) {
- ulong __user *p = argp;
- int i;
- if (!access_ok(VERIFY_WRITE, p,
- sizeof(ulong) * ISDN_MAX_CHANNELS * 2))
- return -EFAULT;
- for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
- put_user(dev->ibytes[i], p++);
- put_user(dev->obytes[i], p++);
- }
- return 0;
- } else
- return -EINVAL;
- break;
+ case IIOCGETDVR:
+ return (TTY_DV +
+ (NET_DV << 8) +
+ (INF_DV << 16));
+ case IIOCGETCPS:
+ if (arg) {
+ ulong __user *p = argp;
+ int i;
+ if (!access_ok(VERIFY_WRITE, p,
+ sizeof(ulong) * ISDN_MAX_CHANNELS * 2))
+ return -EFAULT;
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
+ put_user(dev->ibytes[i], p++);
+ put_user(dev->obytes[i], p++);
+ }
+ return 0;
+ } else
+ return -EINVAL;
+ break;
#ifdef CONFIG_NETDEVICES
- case IIOCNETGPN:
- /* Get peer phone number of a connected
- * isdn network interface */
- if (arg) {
- if (copy_from_user(&phone, argp, sizeof(phone)))
- return -EFAULT;
- return isdn_net_getpeer(&phone, argp);
- } else
- return -EINVAL;
-#endif
- default:
+ case IIOCNETGPN:
+ /* Get peer phone number of a connected
+ * isdn network interface */
+ if (arg) {
+ if (copy_from_user(&phone, argp, sizeof(phone)))
+ return -EFAULT;
+ return isdn_net_getpeer(&phone, argp);
+ } else
return -EINVAL;
+#endif
+ default:
+ return -EINVAL;
}
}
if (!dev->drivers)
@@ -1347,360 +1347,360 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
* are serialized by means of a semaphore.
*/
switch (cmd) {
- case IIOCNETDWRSET:
- printk(KERN_INFO "INFO: ISDN_DW_ABC_EXTENSION not enabled\n");
- return(-EINVAL);
- case IIOCNETLCR:
- printk(KERN_INFO "INFO: ISDN_ABC_LCR_SUPPORT not enabled\n");
- return -ENODEV;
+ case IIOCNETDWRSET:
+ printk(KERN_INFO "INFO: ISDN_DW_ABC_EXTENSION not enabled\n");
+ return (-EINVAL);
+ case IIOCNETLCR:
+ printk(KERN_INFO "INFO: ISDN_ABC_LCR_SUPPORT not enabled\n");
+ return -ENODEV;
#ifdef CONFIG_NETDEVICES
- case IIOCNETAIF:
- /* Add a network-interface */
- if (arg) {
- if (copy_from_user(name, argp, sizeof(name)))
- return -EFAULT;
- s = name;
+ case IIOCNETAIF:
+ /* Add a network-interface */
+ if (arg) {
+ if (copy_from_user(name, argp, sizeof(name)))
+ return -EFAULT;
+ s = name;
+ } else {
+ s = NULL;
+ }
+ ret = mutex_lock_interruptible(&dev->mtx);
+ if (ret) return ret;
+ if ((s = isdn_net_new(s, NULL))) {
+ if (copy_to_user(argp, s, strlen(s) + 1)) {
+ ret = -EFAULT;
+ } else {
+ ret = 0;
+ }
+ } else
+ ret = -ENODEV;
+ mutex_unlock(&dev->mtx);
+ return ret;
+ case IIOCNETASL:
+ /* Add a slave to a network-interface */
+ if (arg) {
+ if (copy_from_user(bname, argp, sizeof(bname) - 1))
+ return -EFAULT;
+ } else
+ return -EINVAL;
+ ret = mutex_lock_interruptible(&dev->mtx);
+ if (ret) return ret;
+ if ((s = isdn_net_newslave(bname))) {
+ if (copy_to_user(argp, s, strlen(s) + 1)) {
+ ret = -EFAULT;
} else {
- s = NULL;
+ ret = 0;
}
+ } else
+ ret = -ENODEV;
+ mutex_unlock(&dev->mtx);
+ return ret;
+ case IIOCNETDIF:
+ /* Delete a network-interface */
+ if (arg) {
+ if (copy_from_user(name, argp, sizeof(name)))
+ return -EFAULT;
ret = mutex_lock_interruptible(&dev->mtx);
- if( ret ) return ret;
- if ((s = isdn_net_new(s, NULL))) {
- if (copy_to_user(argp, s, strlen(s) + 1)){
- ret = -EFAULT;
- } else {
- ret = 0;
- }
- } else
- ret = -ENODEV;
+ if (ret) return ret;
+ ret = isdn_net_rm(name);
mutex_unlock(&dev->mtx);
return ret;
- case IIOCNETASL:
- /* Add a slave to a network-interface */
- if (arg) {
- if (copy_from_user(bname, argp, sizeof(bname) - 1))
+ } else
+ return -EINVAL;
+ case IIOCNETSCF:
+ /* Set configurable parameters of a network-interface */
+ if (arg) {
+ if (copy_from_user(&cfg, argp, sizeof(cfg)))
+ return -EFAULT;
+ return isdn_net_setcfg(&cfg);
+ } else
+ return -EINVAL;
+ case IIOCNETGCF:
+ /* Get configurable parameters of a network-interface */
+ if (arg) {
+ if (copy_from_user(&cfg, argp, sizeof(cfg)))
+ return -EFAULT;
+ if (!(ret = isdn_net_getcfg(&cfg))) {
+ if (copy_to_user(argp, &cfg, sizeof(cfg)))
return -EFAULT;
- } else
- return -EINVAL;
+ }
+ return ret;
+ } else
+ return -EINVAL;
+ case IIOCNETANM:
+ /* Add a phone-number to a network-interface */
+ if (arg) {
+ if (copy_from_user(&phone, argp, sizeof(phone)))
+ return -EFAULT;
ret = mutex_lock_interruptible(&dev->mtx);
- if( ret ) return ret;
- if ((s = isdn_net_newslave(bname))) {
- if (copy_to_user(argp, s, strlen(s) + 1)){
- ret = -EFAULT;
- } else {
- ret = 0;
- }
- } else
- ret = -ENODEV;
+ if (ret) return ret;
+ ret = isdn_net_addphone(&phone);
mutex_unlock(&dev->mtx);
return ret;
- case IIOCNETDIF:
- /* Delete a network-interface */
- if (arg) {
- if (copy_from_user(name, argp, sizeof(name)))
- return -EFAULT;
- ret = mutex_lock_interruptible(&dev->mtx);
- if( ret ) return ret;
- ret = isdn_net_rm(name);
- mutex_unlock(&dev->mtx);
- return ret;
- } else
- return -EINVAL;
- case IIOCNETSCF:
- /* Set configurable parameters of a network-interface */
- if (arg) {
- if (copy_from_user(&cfg, argp, sizeof(cfg)))
- return -EFAULT;
- return isdn_net_setcfg(&cfg);
- } else
- return -EINVAL;
- case IIOCNETGCF:
- /* Get configurable parameters of a network-interface */
- if (arg) {
- if (copy_from_user(&cfg, argp, sizeof(cfg)))
- return -EFAULT;
- if (!(ret = isdn_net_getcfg(&cfg))) {
- if (copy_to_user(argp, &cfg, sizeof(cfg)))
- return -EFAULT;
- }
- return ret;
- } else
- return -EINVAL;
- case IIOCNETANM:
- /* Add a phone-number to a network-interface */
- if (arg) {
- if (copy_from_user(&phone, argp, sizeof(phone)))
- return -EFAULT;
- ret = mutex_lock_interruptible(&dev->mtx);
- if( ret ) return ret;
- ret = isdn_net_addphone(&phone);
- mutex_unlock(&dev->mtx);
- return ret;
- } else
- return -EINVAL;
- case IIOCNETGNM:
- /* Get list of phone-numbers of a network-interface */
- if (arg) {
- if (copy_from_user(&phone, argp, sizeof(phone)))
- return -EFAULT;
- ret = mutex_lock_interruptible(&dev->mtx);
- if( ret ) return ret;
- ret = isdn_net_getphones(&phone, argp);
- mutex_unlock(&dev->mtx);
- return ret;
- } else
- return -EINVAL;
- case IIOCNETDNM:
- /* Delete a phone-number of a network-interface */
- if (arg) {
- if (copy_from_user(&phone, argp, sizeof(phone)))
- return -EFAULT;
- ret = mutex_lock_interruptible(&dev->mtx);
- if( ret ) return ret;
- ret = isdn_net_delphone(&phone);
- mutex_unlock(&dev->mtx);
- return ret;
- } else
- return -EINVAL;
- case IIOCNETDIL:
- /* Force dialing of a network-interface */
- if (arg) {
- if (copy_from_user(name, argp, sizeof(name)))
- return -EFAULT;
- return isdn_net_force_dial(name);
- } else
- return -EINVAL;
-#ifdef CONFIG_ISDN_PPP
- case IIOCNETALN:
- if (!arg)
- return -EINVAL;
- if (copy_from_user(name, argp, sizeof(name)))
+ } else
+ return -EINVAL;
+ case IIOCNETGNM:
+ /* Get list of phone-numbers of a network-interface */
+ if (arg) {
+ if (copy_from_user(&phone, argp, sizeof(phone)))
return -EFAULT;
- return isdn_ppp_dial_slave(name);
- case IIOCNETDLN:
- if (!arg)
- return -EINVAL;
- if (copy_from_user(name, argp, sizeof(name)))
+ ret = mutex_lock_interruptible(&dev->mtx);
+ if (ret) return ret;
+ ret = isdn_net_getphones(&phone, argp);
+ mutex_unlock(&dev->mtx);
+ return ret;
+ } else
+ return -EINVAL;
+ case IIOCNETDNM:
+ /* Delete a phone-number of a network-interface */
+ if (arg) {
+ if (copy_from_user(&phone, argp, sizeof(phone)))
return -EFAULT;
- return isdn_ppp_hangup_slave(name);
-#endif
- case IIOCNETHUP:
- /* Force hangup of a network-interface */
- if (!arg)
- return -EINVAL;
+ ret = mutex_lock_interruptible(&dev->mtx);
+ if (ret) return ret;
+ ret = isdn_net_delphone(&phone);
+ mutex_unlock(&dev->mtx);
+ return ret;
+ } else
+ return -EINVAL;
+ case IIOCNETDIL:
+ /* Force dialing of a network-interface */
+ if (arg) {
if (copy_from_user(name, argp, sizeof(name)))
return -EFAULT;
- return isdn_net_force_hangup(name);
- break;
+ return isdn_net_force_dial(name);
+ } else
+ return -EINVAL;
+#ifdef CONFIG_ISDN_PPP
+ case IIOCNETALN:
+ if (!arg)
+ return -EINVAL;
+ if (copy_from_user(name, argp, sizeof(name)))
+ return -EFAULT;
+ return isdn_ppp_dial_slave(name);
+ case IIOCNETDLN:
+ if (!arg)
+ return -EINVAL;
+ if (copy_from_user(name, argp, sizeof(name)))
+ return -EFAULT;
+ return isdn_ppp_hangup_slave(name);
+#endif
+ case IIOCNETHUP:
+ /* Force hangup of a network-interface */
+ if (!arg)
+ return -EINVAL;
+ if (copy_from_user(name, argp, sizeof(name)))
+ return -EFAULT;
+ return isdn_net_force_hangup(name);
+ break;
#endif /* CONFIG_NETDEVICES */
- case IIOCSETVER:
- dev->net_verbose = arg;
- printk(KERN_INFO "isdn: Verbose-Level is %d\n", dev->net_verbose);
- return 0;
- case IIOCSETGST:
- if (arg)
- dev->global_flags |= ISDN_GLOBAL_STOPPED;
- else
- dev->global_flags &= ~ISDN_GLOBAL_STOPPED;
- printk(KERN_INFO "isdn: Global Mode %s\n",
- (dev->global_flags & ISDN_GLOBAL_STOPPED) ? "stopped" : "running");
- return 0;
- case IIOCSETBRJ:
- drvidx = -1;
- if (arg) {
- int i;
- char *p;
- if (copy_from_user(&iocts, argp,
- sizeof(isdn_ioctl_struct)))
- return -EFAULT;
- iocts.drvid[sizeof(iocts.drvid)-1] = 0;
- if (strlen(iocts.drvid)) {
- if ((p = strchr(iocts.drvid, ',')))
- *p = 0;
- drvidx = -1;
- for (i = 0; i < ISDN_MAX_DRIVERS; i++)
- if (!(strcmp(dev->drvid[i], iocts.drvid))) {
- drvidx = i;
- break;
- }
- }
+ case IIOCSETVER:
+ dev->net_verbose = arg;
+ printk(KERN_INFO "isdn: Verbose-Level is %d\n", dev->net_verbose);
+ return 0;
+ case IIOCSETGST:
+ if (arg)
+ dev->global_flags |= ISDN_GLOBAL_STOPPED;
+ else
+ dev->global_flags &= ~ISDN_GLOBAL_STOPPED;
+ printk(KERN_INFO "isdn: Global Mode %s\n",
+ (dev->global_flags & ISDN_GLOBAL_STOPPED) ? "stopped" : "running");
+ return 0;
+ case IIOCSETBRJ:
+ drvidx = -1;
+ if (arg) {
+ int i;
+ char *p;
+ if (copy_from_user(&iocts, argp,
+ sizeof(isdn_ioctl_struct)))
+ return -EFAULT;
+ iocts.drvid[sizeof(iocts.drvid) - 1] = 0;
+ if (strlen(iocts.drvid)) {
+ if ((p = strchr(iocts.drvid, ',')))
+ *p = 0;
+ drvidx = -1;
+ for (i = 0; i < ISDN_MAX_DRIVERS; i++)
+ if (!(strcmp(dev->drvid[i], iocts.drvid))) {
+ drvidx = i;
+ break;
+ }
}
- if (drvidx == -1)
- return -ENODEV;
- if (iocts.arg)
- dev->drv[drvidx]->flags |= DRV_FLAG_REJBUS;
- else
- dev->drv[drvidx]->flags &= ~DRV_FLAG_REJBUS;
- return 0;
- case IIOCSIGPRF:
- dev->profd = current;
- return 0;
- break;
- case IIOCGETPRF:
- /* Get all Modem-Profiles */
- if (arg) {
- char __user *p = argp;
- int i;
-
- if (!access_ok(VERIFY_WRITE, argp,
- (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN)
- * ISDN_MAX_CHANNELS))
+ }
+ if (drvidx == -1)
+ return -ENODEV;
+ if (iocts.arg)
+ dev->drv[drvidx]->flags |= DRV_FLAG_REJBUS;
+ else
+ dev->drv[drvidx]->flags &= ~DRV_FLAG_REJBUS;
+ return 0;
+ case IIOCSIGPRF:
+ dev->profd = current;
+ return 0;
+ break;
+ case IIOCGETPRF:
+ /* Get all Modem-Profiles */
+ if (arg) {
+ char __user *p = argp;
+ int i;
+
+ if (!access_ok(VERIFY_WRITE, argp,
+ (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN)
+ * ISDN_MAX_CHANNELS))
+ return -EFAULT;
+
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
+ if (copy_to_user(p, dev->mdm.info[i].emu.profile,
+ ISDN_MODEM_NUMREG))
+ return -EFAULT;
+ p += ISDN_MODEM_NUMREG;
+ if (copy_to_user(p, dev->mdm.info[i].emu.pmsn, ISDN_MSNLEN))
return -EFAULT;
+ p += ISDN_MSNLEN;
+ if (copy_to_user(p, dev->mdm.info[i].emu.plmsn, ISDN_LMSNLEN))
+ return -EFAULT;
+ p += ISDN_LMSNLEN;
+ }
+ return (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN) * ISDN_MAX_CHANNELS;
+ } else
+ return -EINVAL;
+ break;
+ case IIOCSETPRF:
+ /* Set all Modem-Profiles */
+ if (arg) {
+ char __user *p = argp;
+ int i;
+
+ if (!access_ok(VERIFY_READ, argp,
+ (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN)
+ * ISDN_MAX_CHANNELS))
+ return -EFAULT;
- for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
- if (copy_to_user(p, dev->mdm.info[i].emu.profile,
- ISDN_MODEM_NUMREG))
- return -EFAULT;
- p += ISDN_MODEM_NUMREG;
- if (copy_to_user(p, dev->mdm.info[i].emu.pmsn, ISDN_MSNLEN))
- return -EFAULT;
- p += ISDN_MSNLEN;
- if (copy_to_user(p, dev->mdm.info[i].emu.plmsn, ISDN_LMSNLEN))
- return -EFAULT;
- p += ISDN_LMSNLEN;
- }
- return (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN) * ISDN_MAX_CHANNELS;
- } else
- return -EINVAL;
- break;
- case IIOCSETPRF:
- /* Set all Modem-Profiles */
- if (arg) {
- char __user *p = argp;
- int i;
-
- if (!access_ok(VERIFY_READ, argp,
- (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN)
- * ISDN_MAX_CHANNELS))
+ for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
+ if (copy_from_user(dev->mdm.info[i].emu.profile, p,
+ ISDN_MODEM_NUMREG))
+ return -EFAULT;
+ p += ISDN_MODEM_NUMREG;
+ if (copy_from_user(dev->mdm.info[i].emu.plmsn, p, ISDN_LMSNLEN))
return -EFAULT;
+ p += ISDN_LMSNLEN;
+ if (copy_from_user(dev->mdm.info[i].emu.pmsn, p, ISDN_MSNLEN))
+ return -EFAULT;
+ p += ISDN_MSNLEN;
+ }
+ return 0;
+ } else
+ return -EINVAL;
+ break;
+ case IIOCSETMAP:
+ case IIOCGETMAP:
+ /* Set/Get MSN->EAZ-Mapping for a driver */
+ if (arg) {
- for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
- if (copy_from_user(dev->mdm.info[i].emu.profile, p,
- ISDN_MODEM_NUMREG))
- return -EFAULT;
- p += ISDN_MODEM_NUMREG;
- if (copy_from_user(dev->mdm.info[i].emu.plmsn, p, ISDN_LMSNLEN))
- return -EFAULT;
- p += ISDN_LMSNLEN;
- if (copy_from_user(dev->mdm.info[i].emu.pmsn, p, ISDN_MSNLEN))
- return -EFAULT;
- p += ISDN_MSNLEN;
- }
- return 0;
+ if (copy_from_user(&iocts, argp,
+ sizeof(isdn_ioctl_struct)))
+ return -EFAULT;
+ iocts.drvid[sizeof(iocts.drvid) - 1] = 0;
+ if (strlen(iocts.drvid)) {
+ drvidx = -1;
+ for (i = 0; i < ISDN_MAX_DRIVERS; i++)
+ if (!(strcmp(dev->drvid[i], iocts.drvid))) {
+ drvidx = i;
+ break;
+ }
} else
- return -EINVAL;
- break;
- case IIOCSETMAP:
- case IIOCGETMAP:
- /* Set/Get MSN->EAZ-Mapping for a driver */
- if (arg) {
+ drvidx = 0;
+ if (drvidx == -1)
+ return -ENODEV;
+ if (cmd == IIOCSETMAP) {
+ int loop = 1;
- if (copy_from_user(&iocts, argp,
- sizeof(isdn_ioctl_struct)))
- return -EFAULT;
- iocts.drvid[sizeof(iocts.drvid)-1] = 0;
- if (strlen(iocts.drvid)) {
- drvidx = -1;
- for (i = 0; i < ISDN_MAX_DRIVERS; i++)
- if (!(strcmp(dev->drvid[i], iocts.drvid))) {
- drvidx = i;
+ p = (char __user *) iocts.arg;
+ i = 0;
+ while (loop) {
+ int j = 0;
+
+ while (1) {
+ if (!access_ok(VERIFY_READ, p, 1))
+ return -EFAULT;
+ get_user(bname[j], p++);
+ switch (bname[j]) {
+ case '\0':
+ loop = 0;
+ /* Fall through */
+ case ',':
+ bname[j] = '\0';
+ strcpy(dev->drv[drvidx]->msn2eaz[i], bname);
+ j = ISDN_MSNLEN;
break;
+ default:
+ j++;
}
- } else
- drvidx = 0;
- if (drvidx == -1)
- return -ENODEV;
- if (cmd == IIOCSETMAP) {
- int loop = 1;
-
- p = (char __user *) iocts.arg;
- i = 0;
- while (loop) {
- int j = 0;
-
- while (1) {
- if (!access_ok(VERIFY_READ, p, 1))
- return -EFAULT;
- get_user(bname[j], p++);
- switch (bname[j]) {
- case '\0':
- loop = 0;
- /* Fall through */
- case ',':
- bname[j] = '\0';
- strcpy(dev->drv[drvidx]->msn2eaz[i], bname);
- j = ISDN_MSNLEN;
- break;
- default:
- j++;
- }
- if (j >= ISDN_MSNLEN)
- break;
- }
- if (++i > 9)
+ if (j >= ISDN_MSNLEN)
break;
}
- } else {
- p = (char __user *) iocts.arg;
- for (i = 0; i < 10; i++) {
- snprintf(bname, sizeof(bname), "%s%s",
- strlen(dev->drv[drvidx]->msn2eaz[i]) ?
- dev->drv[drvidx]->msn2eaz[i] : "_",
- (i < 9) ? "," : "\0");
- if (copy_to_user(p, bname, strlen(bname) + 1))
- return -EFAULT;
- p += strlen(bname);
- }
+ if (++i > 9)
+ break;
}
- return 0;
- } else
- return -EINVAL;
- case IIOCDBGVAR:
- if (arg) {
- if (copy_to_user(argp, &dev, sizeof(ulong)))
- return -EFAULT;
- return 0;
- } else
- return -EINVAL;
- break;
- default:
- if ((cmd & IIOCDRVCTL) == IIOCDRVCTL)
- cmd = ((cmd >> _IOC_NRSHIFT) & _IOC_NRMASK) & ISDN_DRVIOCTL_MASK;
- else
- return -EINVAL;
- if (arg) {
- int i;
- char *p;
- if (copy_from_user(&iocts, argp, sizeof(isdn_ioctl_struct)))
- return -EFAULT;
- iocts.drvid[sizeof(iocts.drvid)-1] = 0;
- if (strlen(iocts.drvid)) {
- if ((p = strchr(iocts.drvid, ',')))
- *p = 0;
- drvidx = -1;
- for (i = 0; i < ISDN_MAX_DRIVERS; i++)
- if (!(strcmp(dev->drvid[i], iocts.drvid))) {
- drvidx = i;
- break;
- }
- } else
- drvidx = 0;
- if (drvidx == -1)
- return -ENODEV;
- if (!access_ok(VERIFY_WRITE, argp,
- sizeof(isdn_ioctl_struct)))
- return -EFAULT;
- c.driver = drvidx;
- c.command = ISDN_CMD_IOCTL;
- c.arg = cmd;
- memcpy(c.parm.num, &iocts.arg, sizeof(ulong));
- ret = isdn_command(&c);
- memcpy(&iocts.arg, c.parm.num, sizeof(ulong));
- if (copy_to_user(argp, &iocts, sizeof(isdn_ioctl_struct)))
- return -EFAULT;
- return ret;
+ } else {
+ p = (char __user *) iocts.arg;
+ for (i = 0; i < 10; i++) {
+ snprintf(bname, sizeof(bname), "%s%s",
+ strlen(dev->drv[drvidx]->msn2eaz[i]) ?
+ dev->drv[drvidx]->msn2eaz[i] : "_",
+ (i < 9) ? "," : "\0");
+ if (copy_to_user(p, bname, strlen(bname) + 1))
+ return -EFAULT;
+ p += strlen(bname);
+ }
+ }
+ return 0;
+ } else
+ return -EINVAL;
+ case IIOCDBGVAR:
+ if (arg) {
+ if (copy_to_user(argp, &dev, sizeof(ulong)))
+ return -EFAULT;
+ return 0;
+ } else
+ return -EINVAL;
+ break;
+ default:
+ if ((cmd & IIOCDRVCTL) == IIOCDRVCTL)
+ cmd = ((cmd >> _IOC_NRSHIFT) & _IOC_NRMASK) & ISDN_DRVIOCTL_MASK;
+ else
+ return -EINVAL;
+ if (arg) {
+ int i;
+ char *p;
+ if (copy_from_user(&iocts, argp, sizeof(isdn_ioctl_struct)))
+ return -EFAULT;
+ iocts.drvid[sizeof(iocts.drvid) - 1] = 0;
+ if (strlen(iocts.drvid)) {
+ if ((p = strchr(iocts.drvid, ',')))
+ *p = 0;
+ drvidx = -1;
+ for (i = 0; i < ISDN_MAX_DRIVERS; i++)
+ if (!(strcmp(dev->drvid[i], iocts.drvid))) {
+ drvidx = i;
+ break;
+ }
} else
- return -EINVAL;
+ drvidx = 0;
+ if (drvidx == -1)
+ return -ENODEV;
+ if (!access_ok(VERIFY_WRITE, argp,
+ sizeof(isdn_ioctl_struct)))
+ return -EFAULT;
+ c.driver = drvidx;
+ c.command = ISDN_CMD_IOCTL;
+ c.arg = cmd;
+ memcpy(c.parm.num, &iocts.arg, sizeof(ulong));
+ ret = isdn_command(&c);
+ memcpy(&iocts.arg, c.parm.num, sizeof(ulong));
+ if (copy_to_user(argp, &iocts, sizeof(isdn_ioctl_struct)))
+ return -EFAULT;
+ return ret;
+ } else
+ return -EINVAL;
}
}
#ifdef CONFIG_ISDN_PPP
@@ -1788,7 +1788,7 @@ isdn_open(struct inode *ino, struct file *filep)
goto out;
}
#endif
- out:
+out:
nonseekable_open(ino, filep);
mutex_unlock(&isdn_mutex);
return retval;
@@ -1832,7 +1832,7 @@ isdn_close(struct inode *ino, struct file *filep)
isdn_ppp_release(minor - ISDN_MINOR_PPP, filep);
#endif
- out:
+out:
mutex_unlock(&isdn_mutex);
return 0;
}
@@ -1868,14 +1868,14 @@ isdn_map_eaz2msn(char *msn, int di)
* Find an unused ISDN-channel, whose feature-flags match the
* given L2- and L3-protocols.
*/
-#define L2V (~(ISDN_FEATURE_L2_V11096|ISDN_FEATURE_L2_V11019|ISDN_FEATURE_L2_V11038))
+#define L2V (~(ISDN_FEATURE_L2_V11096 | ISDN_FEATURE_L2_V11019 | ISDN_FEATURE_L2_V11038))
/*
* This function must be called with holding the dev->lock.
*/
int
isdn_get_free_channel(int usage, int l2_proto, int l3_proto, int pre_dev
- ,int pre_chan, char *msn)
+ , int pre_chan, char *msn)
{
int i;
ulong features;
@@ -1883,7 +1883,7 @@ isdn_get_free_channel(int usage, int l2_proto, int l3_proto, int pre_dev
features = ((1 << l2_proto) | (0x10000 << l3_proto));
vfeatures = (((1 << l2_proto) | (0x10000 << l3_proto)) &
- ~(ISDN_FEATURE_L2_V11096|ISDN_FEATURE_L2_V11019|ISDN_FEATURE_L2_V11038));
+ ~(ISDN_FEATURE_L2_V11096 | ISDN_FEATURE_L2_V11019 | ISDN_FEATURE_L2_V11038));
/* If Layer-2 protocol is V.110, accept drivers with
* transparent feature even if these don't support V.110
* because we can emulate this in linklevel.
@@ -1893,12 +1893,12 @@ isdn_get_free_channel(int usage, int l2_proto, int l3_proto, int pre_dev
(dev->drvmap[i] != -1)) {
int d = dev->drvmap[i];
if ((dev->usage[i] & ISDN_USAGE_EXCLUSIVE) &&
- ((pre_dev != d) || (pre_chan != dev->chanmap[i])))
+ ((pre_dev != d) || (pre_chan != dev->chanmap[i])))
continue;
if (!strcmp(isdn_map_eaz2msn(msn, d), "-"))
continue;
if (dev->usage[i] & ISDN_USAGE_DISABLED)
- continue; /* usage not allowed */
+ continue; /* usage not allowed */
if (dev->drv[d]->flags & DRV_FLAG_RUNNING) {
if (((dev->drv[d]->interface->features & features) == features) ||
(((dev->drv[d]->interface->features & vfeatures) == vfeatures) &&
@@ -1932,7 +1932,7 @@ isdn_free_channel(int di, int ch, int usage)
if ((di < 0) || (ch < 0)) {
printk(KERN_WARNING "%s: called with invalid drv(%d) or channel(%d)\n",
- __func__, di, ch);
+ __func__, di, ch);
return;
}
for (i = 0; i < ISDN_MAX_CHANNELS; i++)
@@ -1976,7 +1976,7 @@ isdn_unexclusive_channel(int di, int ch)
* writebuf replacement for SKB_ABLE drivers
*/
static int
-isdn_writebuf_stub(int drvidx, int chan, const u_char __user * buf, int len)
+isdn_writebuf_stub(int drvidx, int chan, const u_char __user *buf, int len)
{
int ret;
int hl = dev->drv[drvidx]->interface->hl_hdrlen;
@@ -2026,8 +2026,8 @@ isdn_writebuf_skb_stub(int drvidx, int chan, int ack, struct sk_buff *skb)
} else {
int hl = dev->drv[drvidx]->interface->hl_hdrlen;
- if( skb_headroom(skb) < hl ){
- /*
+ if (skb_headroom(skb) < hl) {
+ /*
* This should only occur when new HL driver with
* increased hl_hdrlen was loaded after netdevice
* was created and connected to the new driver.
@@ -2035,13 +2035,13 @@ isdn_writebuf_skb_stub(int drvidx, int chan, int ack, struct sk_buff *skb)
* The V.110 branch (re-allocates on its own) does
* not need this
*/
- struct sk_buff * skb_tmp;
+ struct sk_buff *skb_tmp;
skb_tmp = skb_realloc_headroom(skb, hl);
printk(KERN_DEBUG "isdn_writebuf_skb_stub: reallocating headroom%s\n", skb_tmp ? "" : " failed");
if (!skb_tmp) return -ENOMEM; /* 0 better? */
ret = dev->drv[drvidx]->interface->writebuf_skb(drvidx, chan, ack, skb_tmp);
- if( ret > 0 ){
+ if (ret > 0) {
dev_kfree_skb(skb);
} else {
dev_kfree_skb(skb_tmp);
@@ -2059,7 +2059,7 @@ isdn_writebuf_skb_stub(int drvidx, int chan, int ack, struct sk_buff *skb)
/* For V.110 return unencoded data length */
ret = v110_ret;
/* if the complete frame was send we free the skb;
- if not upper function will requeue the skb */
+ if not upper function will requeue the skb */
if (ret == skb->len)
dev_kfree_skb(skb);
}
@@ -2077,7 +2077,7 @@ isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding)
init_waitqueue_head(&d->st_waitq);
if (d->flags & DRV_FLAG_RUNNING)
return -1;
- if (n < 1) return 0;
+ if (n < 1) return 0;
m = (adding) ? d->channels + n : n;
@@ -2114,7 +2114,7 @@ isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding)
kfree(d->rcvcount);
kfree(d->rcverr);
}
- return -1;
+ return -1;
}
for (j = 0; j < m; j++) {
skb_queue_head_init(&d->rpqueue[j]);
@@ -2172,45 +2172,45 @@ set_global_features(void)
static char *map_drvname(int di)
{
- if ((di < 0) || (di >= ISDN_MAX_DRIVERS))
- return(NULL);
- return(dev->drvid[di]); /* driver name */
+ if ((di < 0) || (di >= ISDN_MAX_DRIVERS))
+ return (NULL);
+ return (dev->drvid[di]); /* driver name */
} /* map_drvname */
static int map_namedrv(char *id)
{ int i;
- for (i = 0; i < ISDN_MAX_DRIVERS; i++)
- { if (!strcmp(dev->drvid[i],id))
- return(i);
- }
- return(-1);
+ for (i = 0; i < ISDN_MAX_DRIVERS; i++)
+ { if (!strcmp(dev->drvid[i], id))
+ return (i);
+ }
+ return (-1);
} /* map_namedrv */
int DIVERT_REG_NAME(isdn_divert_if *i_div)
{
- if (i_div->if_magic != DIVERT_IF_MAGIC)
- return(DIVERT_VER_ERR);
- switch (i_div->cmd)
- {
- case DIVERT_CMD_REL:
- if (divert_if != i_div)
- return(DIVERT_REL_ERR);
- divert_if = NULL; /* free interface */
- return(DIVERT_NO_ERR);
-
- case DIVERT_CMD_REG:
- if (divert_if)
- return(DIVERT_REG_ERR);
- i_div->ll_cmd = isdn_command; /* set command function */
- i_div->drv_to_name = map_drvname;
- i_div->name_to_drv = map_namedrv;
- divert_if = i_div; /* remember interface */
- return(DIVERT_NO_ERR);
-
- default:
- return(DIVERT_CMD_ERR);
- }
+ if (i_div->if_magic != DIVERT_IF_MAGIC)
+ return (DIVERT_VER_ERR);
+ switch (i_div->cmd)
+ {
+ case DIVERT_CMD_REL:
+ if (divert_if != i_div)
+ return (DIVERT_REL_ERR);
+ divert_if = NULL; /* free interface */
+ return (DIVERT_NO_ERR);
+
+ case DIVERT_CMD_REG:
+ if (divert_if)
+ return (DIVERT_REG_ERR);
+ i_div->ll_cmd = isdn_command; /* set command function */
+ i_div->drv_to_name = map_drvname;
+ i_div->name_to_drv = map_namedrv;
+ divert_if = i_div; /* remember interface */
+ return (DIVERT_NO_ERR);
+
+ default:
+ return (DIVERT_CMD_ERR);
+ }
} /* DIVERT_REG_NAME */
EXPORT_SYMBOL(DIVERT_REG_NAME);
@@ -2225,7 +2225,7 @@ EXPORT_SYMBOL(isdn_ppp_unregister_compressor);
#endif
int
-register_isdn(isdn_if * i)
+register_isdn(isdn_if *i)
{
isdn_driver_t *d;
int j;
@@ -2280,10 +2280,10 @@ register_isdn(isdn_if * i)
}
/*
- *****************************************************************************
- * And now the modules code.
- *****************************************************************************
- */
+*****************************************************************************
+* And now the modules code.
+*****************************************************************************
+*/
static char *
isdn_getrev(const char *revision)