]> git.neil.brown.name Git - history.git/commitdiff
ISDN: Remove ttyI specific from global "dev" variable
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Tue, 29 Oct 2002 14:47:51 +0000 (08:47 -0600)
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Tue, 29 Oct 2002 14:47:51 +0000 (08:47 -0600)
ISDN still has a huge global struct called "dev", which is a mess
of parts which should be private to their respective subsystem.
It's supposed to die, this is another step in making that happen.

drivers/isdn/i4l/isdn_common.c
drivers/isdn/i4l/isdn_net_lib.c
drivers/isdn/i4l/isdn_tty.c
drivers/isdn/i4l/isdn_tty.h
include/linux/isdn.h

index 18d6061d5a246b8a0b386e2d8b90eb1191356342..a64e8a2921aa236e6e6e0a391fed0279f6e54bac 100644 (file)
@@ -356,10 +356,15 @@ slot_icall(struct fsm_inst *fi, int pr, void *arg)
        return 0;
 }
 
+/* should become broadcast later */
 static int
 slot_in_dhup(struct fsm_inst *fi, int pr, void *arg)
 {
+       struct isdn_slot *slot = fi->userdata;
+       isdn_ctrl *ctrl = arg;
+
        fsm_change_state(fi, ST_SLOT_NULL);
+       do_stat_cb(slot, ctrl);
        return 0;
 }
 
@@ -1847,14 +1852,14 @@ isdn_ctrl_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
                                return ret;
 
                        for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
-                               if (copy_to_user(p, dev->mdm.info[i].emu.profile,
+                               if (copy_to_user(p, isdn_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))
+                               if (copy_to_user(p, isdn_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))
+                               if (copy_to_user(p, isdn_mdm.info[i].emu.plmsn, ISDN_LMSNLEN))
                                        return -EFAULT;
                                p += ISDN_LMSNLEN;
                        }
@@ -1874,14 +1879,14 @@ isdn_ctrl_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
                                return ret;
 
                        for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
-                               if (copy_from_user(dev->mdm.info[i].emu.profile, p,
+                               if (copy_from_user(isdn_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))
+                               if (copy_from_user(isdn_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))
+                               if (copy_from_user(isdn_mdm.info[i].emu.pmsn, p, ISDN_MSNLEN))
                                        return -EFAULT;
                                p += ISDN_MSNLEN;
                        }
@@ -2403,7 +2408,6 @@ isdn_slot_command(int sl, int cmd, isdn_ctrl *ctrl)
                return fsm_event(&slots[sl].fi, EV_SLOT_CMD_HANGUP, ctrl);
        }
        HERE;
-//     return isdn_command(ctrl);
        return -1;
 }
 
@@ -2683,8 +2687,8 @@ static int __init isdn_init(void)
                slots[i].ch = -1;
                slots[i].m_idx = -1;
                strcpy(isdn_slot_num(i), "???");
-               init_waitqueue_head(&dev->mdm.info[i].open_wait);
-               init_waitqueue_head(&dev->mdm.info[i].close_wait);
+               init_waitqueue_head(&isdn_mdm.info[i].open_wait);
+               init_waitqueue_head(&isdn_mdm.info[i].close_wait);
                slots[i].fi.fsm = &slot_fsm;
                slots[i].fi.state = ST_SLOT_NULL;
                slots[i].fi.debug = 1;
index 6b4c452c0bdc0ec6833e995bdb32681a753ee269..36685d31235bdd7ff9437ef1071db9937940a147 100644 (file)
@@ -408,7 +408,7 @@ isdn_net_addif(char *name, isdn_net_local *mlp)
                mlp->hupflags = ISDN_INHUP;
                mlp->onhtime = 10;
                mlp->dialmax = 1;
-               mlp->flags = ISDN_NET_CBHUP | ISDN_NET_DM_MANUAL;
+               mlp->flags = ISDN_NET_CBHUP | ISDN_NET_DM_MANUAL | ISDN_NET_SECURE;
                mlp->cbdelay = 5 * HZ;     /* Wait 5 secs before call-back  */
                mlp->dialtimeout = 60 * HZ;/* Wait 1 min for connection     */
                mlp->dialwait = 5 * HZ;    /* Wait 5 sec. after failed dial */
index 4b44a7d388715c18422e945fe2de947cf4cdf124..a4c7d393e58aec7cf2ad43b384848adbab51f2bb 100644 (file)
@@ -48,6 +48,8 @@ static char *isdn_ttyname_ttyI = "ttyI";
 static char *isdn_ttyname_cui = "cui";
 #endif
 
+struct isdn_modem isdn_mdm;
+
 static int bit2si[8] =
 {1, 5, 7, 7, 7, 7, 7, 7};
 static int si2bit[8] =
@@ -126,7 +128,7 @@ isdn_tty_readmodem(void)
 
        for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
                if ((midx = isdn_slot_m_idx(i)) >= 0) {
-                       info = &dev->mdm.info[midx];
+                       info = &isdn_mdm.info[midx];
                        if (info->online) {
                                r = 0;
 #ifdef CONFIG_ISDN_AUDIO
@@ -1669,7 +1671,7 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp)
        line = minor(tty->device) - tty->driver.minor_start;
        if (line < 0 || line > ISDN_MAX_CHANNELS)
                return -ENODEV;
-       info = &dev->mdm.info[line];
+       info = &isdn_mdm.info[line];
        if (isdn_tty_paranoia_check(info, tty->device, "isdn_tty_open"))
                return -ENODEV;
 #ifdef ISDN_DEBUG_MODEM_OPEN
@@ -1939,11 +1941,11 @@ modem_write_profile(atemu * m)
 int
 isdn_tty_init(void)
 {
-       modem *m;
+       struct isdn_modem *m;
        int i, retval;
        modem_info *info;
 
-       m = &dev->mdm;
+       m = &isdn_mdm;
        memset(&m->tty_modem, 0, sizeof(struct tty_driver));
        m->tty_modem.magic = TTY_DRIVER_MAGIC;
        m->tty_modem.name = isdn_ttyname_ttyI;
@@ -2049,9 +2051,9 @@ isdn_tty_init(void)
 #endif
                kfree(info->xmit_buf - 4);
        }
-       tty_unregister_driver(&dev->mdm.cua_modem);
+       tty_unregister_driver(&isdn_mdm.cua_modem);
  err_unregister_tty:
-       tty_unregister_driver(&dev->mdm.tty_modem);
+       tty_unregister_driver(&isdn_mdm.tty_modem);
  err:
        return retval;
 }
@@ -2059,20 +2061,19 @@ isdn_tty_init(void)
 void
 isdn_tty_exit(void)
 {
-       modem *m = &dev->mdm;
        modem_info *info;
        int i;
 
        for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
-               info = &m->info[i];
+               info = &isdn_mdm.info[i];
                isdn_tty_cleanup_xmit(info);
 #ifdef CONFIG_ISDN_TTY_FAX
                kfree(info->fax);
 #endif
                kfree(info->xmit_buf - 4);
        }
-       tty_unregister_driver(&dev->mdm.cua_modem);
-       tty_unregister_driver(&dev->mdm.tty_modem);
+       tty_unregister_driver(&isdn_mdm.cua_modem);
+       tty_unregister_driver(&isdn_mdm.tty_modem);
 }
 
 /*
@@ -2168,7 +2169,7 @@ isdn_tty_find_icall(int di, int ch, int sl, setup_parm *setup)
        save_flags(flags);
        cli();
        for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
-               modem_info *info = &dev->mdm.info[i];
+               modem_info *info = &isdn_mdm.info[i];
 
                 if (info->count == 0)
                     continue;
@@ -2354,7 +2355,7 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c)
                                printk(KERN_DEBUG "tty_STAT_UNLOAD ttyI%d\n", info->line);
 #endif
                                for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
-                                       info = &dev->mdm.info[i];
+                                       info = &isdn_mdm.info[i];
                                        if (isdn_slot_driver(info->isdn_slot) == c->driver) {
                                                if (info->online)
                                                        isdn_tty_modem_hup(info, 1);
@@ -3905,7 +3906,7 @@ isdn_tty_modem_escape(void)
        for (i = 0; i < ISDN_MAX_CHANNELS; i++)
                if (USG_MODEM(isdn_slot_usage(i)))
                        if ((midx = isdn_slot_m_idx(i)) >= 0) {
-                               modem_info *info = &dev->mdm.info[midx];
+                               modem_info *info = &isdn_mdm.info[midx];
                                if (info->online) {
                                        ton = 1;
                                        if ((info->emu.pluscount == 3) &&
@@ -3931,7 +3932,7 @@ isdn_tty_modem_ring(void)
        int i;
 
        for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
-               modem_info *info = &dev->mdm.info[i];
+               modem_info *info = &isdn_mdm.info[i];
                if (info->msr & UART_MSR_RI) {
                        ton = 1;
                        isdn_tty_modem_result(RESULT_RING, info);
@@ -3951,7 +3952,7 @@ isdn_tty_modem_xmit(void)
        int i;
 
        for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
-               modem_info *info = &dev->mdm.info[i];
+               modem_info *info = &isdn_mdm.info[i];
                if (info->online) {
                        ton = 1;
                        isdn_tty_senddown(info);
@@ -3972,7 +3973,7 @@ isdn_tty_carrier_timeout(void)
        int i;
 
        for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
-               modem_info *info = &dev->mdm.info[i];
+               modem_info *info = &isdn_mdm.info[i];
                if (info->dialing) {
                        if (info->emu.carrierwait++ > info->emu.mdmreg[REG_WAITC]) {
                                info->dialing = 0;
index 5b82b66fc1342d62ea29955cf08e86c164b16062..48194fd4c6194c8839f8a4bc7bd1af2956ed67eb 100644 (file)
@@ -117,3 +117,15 @@ extern void isdn_tty_fax_bitorder(modem_info *, struct sk_buff *);
 
 extern int isdn_tty_init(void);
 extern void isdn_tty_exit(void);
+
+struct isdn_modem {
+  int                refcount;                    /* Number of opens        */
+  struct tty_driver  tty_modem;                           /* tty-device             */
+  struct tty_driver  cua_modem;                           /* cua-device             */
+  struct tty_struct  *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */
+  struct termios     *modem_termios[ISDN_MAX_CHANNELS];
+  struct termios     *modem_termios_locked[ISDN_MAX_CHANNELS];
+  modem_info         info[ISDN_MAX_CHANNELS];     /* Private data           */
+};
+
+extern struct isdn_modem isdn_mdm;
index ded1aad43e4cff163e42ad8a66e62c387e44877e..74376a0a5e38ef861b897531c9d1741ee952f284 100644 (file)
@@ -368,17 +368,6 @@ typedef struct modem_info {
 
 #define ISDN_MODEM_WINSIZE 8
 
-/* Description of one ISDN-tty */
-typedef struct {
-  int                refcount;                    /* Number of opens        */
-  struct tty_driver  tty_modem;                           /* tty-device             */
-  struct tty_driver  cua_modem;                           /* cua-device             */
-  struct tty_struct  *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */
-  struct termios     *modem_termios[ISDN_MAX_CHANNELS];
-  struct termios     *modem_termios_locked[ISDN_MAX_CHANNELS];
-  modem_info         info[ISDN_MAX_CHANNELS];     /* Private data           */
-} modem;
-
 /*======================= End of ISDN-tty stuff ============================*/
 
 /*======================== Start of V.110 stuff ============================*/
@@ -427,7 +416,6 @@ typedef struct isdn_devt {
        wait_queue_head_t info_waitq;               /* Wait-Queue for isdninfo    */
        struct timer_list timer;                       /* Misc.-function Timer       */
        struct task_struct *profd;                   /* For iprofd                 */
-       modem             mdm;                 /* tty-driver-data            */
        struct semaphore  sem;                       /* serialize list access*/
        unsigned long     global_features;
 #ifdef CONFIG_DEVFS_FS