]> git.neil.brown.name Git - history.git/commitdiff
ISDN: ttyI cleanups
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Tue, 29 Oct 2002 15:01:57 +0000 (09:01 -0600)
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Tue, 29 Oct 2002 15:01:57 +0000 (09:01 -0600)
Now that ttyI's take care of their own business, some cross links
between isdn_common and isdn_tty can finally go away.

drivers/isdn/i4l/isdn_common.c
drivers/isdn/i4l/isdn_common.h
drivers/isdn/i4l/isdn_net_lib.c
drivers/isdn/i4l/isdn_tty.c
drivers/isdn/i4l/isdn_ttyfax.c

index ff0f63576bb0e9781eb9952ca89b3bfca279fc7e..beba71ff182da7812a0eab2c8fac0e40b4b307d3 100644 (file)
@@ -2178,34 +2178,6 @@ isdn_slot_dial(struct isdn_slot *slot, struct dial_info *dial)
        return isdn_slot_command(slot, ISDN_CMD_DIAL, &cmd);
 }
 
-int
-isdn_slot_usage(int sl)
-{
-       BUG_ON(sl < 0);
-
-       return slots[sl].usage;
-}
-
-int
-isdn_slot_m_idx(int sl)
-{
-       BUG_ON(sl < 0);
-
-       return slots[sl].m_idx;
-}
-
-void
-isdn_slot_set_m_idx(struct isdn_slot *slot, int midx)
-{
-       slot->m_idx = midx;
-}
-
-char *
-isdn_slot_num(struct isdn_slot *slot)
-{
-       return slot->num;
-}
-
 int
 isdn_hard_header_len(void)
 {
@@ -2334,10 +2306,7 @@ static int __init isdn_init(void)
        for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
                slots[i].di = -1;
                slots[i].ch = -1;
-               slots[i].m_idx = -1;
                strcpy(slots[i].num, "???");
-               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 ebed1119eb25ac4275f260a9bec44ef2c0320a31..ff80a006372224b13f90e020407285e97107c5e2 100644 (file)
@@ -57,7 +57,6 @@ extern void isdn_MOD_INC_USE_COUNT(void);
 extern void isdn_MOD_DEC_USE_COUNT(void);
 extern void isdn_lock_drivers(void);
 extern void isdn_unlock_drivers(void);
-extern void isdn_free_channel(int di, int ch, int usage);
 extern void isdn_info_update(void);
 extern char *isdn_map_eaz2msn(char *msn, int di);
 extern int isdn_getnum(char **);
@@ -77,7 +76,6 @@ struct isdn_slot {
        unsigned long     ibytes;              /* Statistics incoming bytes  */
        unsigned long     obytes;              /* Statistics outgoing bytes  */
        struct isdn_v110  iv110;               /* For V.110                  */
-       int               m_idx;               /* Index for mdm....          */
        void             *priv;                /* pointer to isdn_net_dev    */
        int             (*event_cb)(struct isdn_slot *, int pr, void *arg);
        struct fsm_inst   fi;
@@ -101,11 +99,7 @@ char *isdn_slot_map_eaz2msn(struct isdn_slot *, char *msn);
 int   isdn_slot_write(struct isdn_slot *, struct sk_buff *);
 int   isdn_slot_hdrlen(struct isdn_slot *);
 int   isdn_slot_maxbufsize(struct isdn_slot *);
-char *isdn_slot_num(struct isdn_slot *);
-void  isdn_slot_set_m_idx(struct isdn_slot *, int midx);
 int   isdn_hard_header_len(void);
-int   isdn_slot_m_idx(int sl);
-int   isdn_slot_usage(int sl);
 
 int   isdn_drv_lookup(char *drvid);
 char *isdn_drv_drvid(int di);
index 78e3874c46a2273829a553464297387593bb1349..f5dc1e8ddd957709bd343ffb769379422b6667dc 100644 (file)
@@ -857,20 +857,13 @@ isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone *peer)
 
        if (!idev)
                return -ENODEV;
-       /* FIXME
-        * Theoretical race: while this executes, the remote number might
-        * become invalid (hang up) or change (new connection), resulting
-         * in (partially) wrong number copied to user. This race
-        * currently ignored.
-        */
-       slot = idev->isdn_slot;
-       if (slot < 0)
-               return -ENOTCONN;
-       /* for pre-bound channels, we need this extra check */
-       if (strncmp(isdn_slot_num(slot), "???", 3) == 0 )
+
+       if (idev->fi.state != ST_ACTIVE)
                return -ENOTCONN;
 
-       strncpy(phone->phone, isdn_slot_num(slot), ISDN_MSNLEN);
+       slot = idev->isdn_slot;
+
+       strncpy(phone->phone, slot->num, ISDN_MSNLEN);
        phone->outgoing = USG_OUTGOING(slot->usage);
 
        if (copy_to_user(peer, phone, sizeof(*peer)))
index 93c9f986025d5b4b3ab2cd3156b4c51014a0bd11..63d15e90ab565666e218161eac37815a1ab35099 100644 (file)
@@ -764,7 +764,6 @@ isdn_tty_dial(char *n, modem_info * info, atemu * m)
                };
 
                info->isdn_slot = slot;
-               isdn_slot_set_m_idx(slot, info->line);
                slot->usage |= ISDN_USAGE_MODEM;
                slot->priv = info;
                slot->event_cb = isdn_tty_event_callback;
@@ -941,7 +940,6 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m)
                isdn_tty_modem_result(RESULT_NO_DIALTONE, info);
        } else {
                info->isdn_slot = slot;
-               isdn_slot_set_m_idx(slot, info->line);
                slot->usage |= ISDN_USAGE_MODEM;
                slot->priv = info;
                slot->event_cb = isdn_tty_event_callback;
@@ -1018,7 +1016,6 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg)
                isdn_tty_modem_result(RESULT_NO_DIALTONE, info);
        } else {
                info->isdn_slot = slot;
-               isdn_slot_set_m_idx(slot, info->line);
                slot->usage |= ISDN_USAGE_MODEM;
                slot->priv = info;
                slot->event_cb = isdn_tty_event_callback;
@@ -2133,6 +2130,8 @@ isdn_tty_init(void)
                init_timer(&info->read_timer);
                info->read_timer.data = (unsigned long) info;
                info->read_timer.function = isdn_tty_readmodem;
+               init_waitqueue_head(&info->open_wait);
+               init_waitqueue_head(&info->close_wait);
                skb_queue_head_init(&info->rpqueue);
                info->xmit_size = ISDN_SERIAL_XMIT_SIZE;
                skb_queue_head_init(&info->xmit_queue);
@@ -2301,7 +2300,6 @@ isdn_tty_find_icall(struct isdn_slot *slot, setup_parm *setup)
                                        wret = matchret;
                                if (!matchret) {                  /* EAZ is matching */
                                        info->isdn_slot = slot;
-                                       isdn_slot_set_m_idx(slot, info->line);
                                        slot->usage |= isdn_calc_usage(si1, info->emu.mdmreg[REG_L2PROT]);
                                        slot->priv = info;
                                        slot->event_cb = isdn_tty_event_callback;
@@ -2740,7 +2738,7 @@ isdn_tty_modem_result(int code, modem_info * info)
                            /* print CID, _before_ _every_ ring */
                            if (!(m->mdmreg[REG_CIDONCE] & BIT_CIDONCE)) {
                                    isdn_tty_at_cout("\r\nCALLER NUMBER: ", info);
-                                   isdn_tty_at_cout(isdn_slot_num(info->isdn_slot), info);
+                                   isdn_tty_at_cout(info->isdn_slot->num, info);
                                    if (m->mdmreg[REG_CDN] & BIT_CDN) {
                                            isdn_tty_at_cout("\r\nCALLED NUMBER: ", info);
                                            isdn_tty_at_cout(info->emu.cpn, info);
@@ -2769,7 +2767,7 @@ isdn_tty_modem_result(int code, modem_info * info)
                                            (m->mdmreg[REG_RINGCNT] == 1)) {
                                                isdn_tty_at_cout("\r\n", info);
                                                isdn_tty_at_cout("CALLER NUMBER: ", info);
-                                               isdn_tty_at_cout(isdn_slot_num(info->isdn_slot), info);
+                                               isdn_tty_at_cout(info->isdn_slot->num, info);
                                                if (m->mdmreg[REG_CDN] & BIT_CDN) {
                                                        isdn_tty_at_cout("\r\nCALLED NUMBER: ", info);
                                                        isdn_tty_at_cout(info->emu.cpn, info);
@@ -3281,7 +3279,7 @@ isdn_tty_cmd_ATA(modem_info * info)
        if (info->msr & UART_MSR_RI) {
                /* Accept incoming call */
                info->last_dir = 0;
-               strcpy(info->last_num, isdn_slot_num(info->isdn_slot));
+               strcpy(info->last_num, info->isdn_slot->num);
                m->mdmreg[REG_RINGCNT] = 0;
                info->msr &= ~UART_MSR_RI;
                l2 = m->mdmreg[REG_L2PROT];
index 35142304fdbe391090d3084fa44c677ee7ca020a..c216f92aaece6ac7f5069355c136e9a87efb1257 100644 (file)
@@ -360,10 +360,8 @@ isdn_tty_cmd_FCLASS1(char **p, modem_info * info)
                        PARSE_ERROR1;
                }
                info->isdn_slot = slot;
-               isdn_slot_set_m_idx(slot, info->line);
                isdn_slot_command(slot, ISDN_CMD_FAXCMD, &c);
                isdn_slot_free(slot);
-               isdn_slot_set_m_idx(slot, -1);
                info->isdn_slot = NULL;
                restore_flags(flags);
        } else {