Commit 5480f44d authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: ttyI cleanups

Now that ttyI's take care of their own business, some cross links
between isdn_common and isdn_tty can finally go away.
parent e6926b12
...@@ -2178,34 +2178,6 @@ isdn_slot_dial(struct isdn_slot *slot, struct dial_info *dial) ...@@ -2178,34 +2178,6 @@ isdn_slot_dial(struct isdn_slot *slot, struct dial_info *dial)
return isdn_slot_command(slot, ISDN_CMD_DIAL, &cmd); 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 int
isdn_hard_header_len(void) isdn_hard_header_len(void)
{ {
...@@ -2334,10 +2306,7 @@ static int __init isdn_init(void) ...@@ -2334,10 +2306,7 @@ static int __init isdn_init(void)
for (i = 0; i < ISDN_MAX_CHANNELS; i++) { for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
slots[i].di = -1; slots[i].di = -1;
slots[i].ch = -1; slots[i].ch = -1;
slots[i].m_idx = -1;
strcpy(slots[i].num, "???"); 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.fsm = &slot_fsm;
slots[i].fi.state = ST_SLOT_NULL; slots[i].fi.state = ST_SLOT_NULL;
slots[i].fi.debug = 1; slots[i].fi.debug = 1;
......
...@@ -57,7 +57,6 @@ extern void isdn_MOD_INC_USE_COUNT(void); ...@@ -57,7 +57,6 @@ extern void isdn_MOD_INC_USE_COUNT(void);
extern void isdn_MOD_DEC_USE_COUNT(void); extern void isdn_MOD_DEC_USE_COUNT(void);
extern void isdn_lock_drivers(void); extern void isdn_lock_drivers(void);
extern void isdn_unlock_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 void isdn_info_update(void);
extern char *isdn_map_eaz2msn(char *msn, int di); extern char *isdn_map_eaz2msn(char *msn, int di);
extern int isdn_getnum(char **); extern int isdn_getnum(char **);
...@@ -77,7 +76,6 @@ struct isdn_slot { ...@@ -77,7 +76,6 @@ struct isdn_slot {
unsigned long ibytes; /* Statistics incoming bytes */ unsigned long ibytes; /* Statistics incoming bytes */
unsigned long obytes; /* Statistics outgoing bytes */ unsigned long obytes; /* Statistics outgoing bytes */
struct isdn_v110 iv110; /* For V.110 */ struct isdn_v110 iv110; /* For V.110 */
int m_idx; /* Index for mdm.... */
void *priv; /* pointer to isdn_net_dev */ void *priv; /* pointer to isdn_net_dev */
int (*event_cb)(struct isdn_slot *, int pr, void *arg); int (*event_cb)(struct isdn_slot *, int pr, void *arg);
struct fsm_inst fi; struct fsm_inst fi;
...@@ -101,11 +99,7 @@ char *isdn_slot_map_eaz2msn(struct isdn_slot *, char *msn); ...@@ -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_write(struct isdn_slot *, struct sk_buff *);
int isdn_slot_hdrlen(struct isdn_slot *); int isdn_slot_hdrlen(struct isdn_slot *);
int isdn_slot_maxbufsize(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_hard_header_len(void);
int isdn_slot_m_idx(int sl);
int isdn_slot_usage(int sl);
int isdn_drv_lookup(char *drvid); int isdn_drv_lookup(char *drvid);
char *isdn_drv_drvid(int di); char *isdn_drv_drvid(int di);
......
...@@ -857,20 +857,13 @@ isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone *peer) ...@@ -857,20 +857,13 @@ isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone *peer)
if (!idev) if (!idev)
return -ENODEV; return -ENODEV;
/* FIXME
* Theoretical race: while this executes, the remote number might if (idev->fi.state != ST_ACTIVE)
* 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 )
return -ENOTCONN; 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); phone->outgoing = USG_OUTGOING(slot->usage);
if (copy_to_user(peer, phone, sizeof(*peer))) if (copy_to_user(peer, phone, sizeof(*peer)))
......
...@@ -764,7 +764,6 @@ isdn_tty_dial(char *n, modem_info * info, atemu * m) ...@@ -764,7 +764,6 @@ isdn_tty_dial(char *n, modem_info * info, atemu * m)
}; };
info->isdn_slot = slot; info->isdn_slot = slot;
isdn_slot_set_m_idx(slot, info->line);
slot->usage |= ISDN_USAGE_MODEM; slot->usage |= ISDN_USAGE_MODEM;
slot->priv = info; slot->priv = info;
slot->event_cb = isdn_tty_event_callback; slot->event_cb = isdn_tty_event_callback;
...@@ -941,7 +940,6 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m) ...@@ -941,7 +940,6 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m)
isdn_tty_modem_result(RESULT_NO_DIALTONE, info); isdn_tty_modem_result(RESULT_NO_DIALTONE, info);
} else { } else {
info->isdn_slot = slot; info->isdn_slot = slot;
isdn_slot_set_m_idx(slot, info->line);
slot->usage |= ISDN_USAGE_MODEM; slot->usage |= ISDN_USAGE_MODEM;
slot->priv = info; slot->priv = info;
slot->event_cb = isdn_tty_event_callback; slot->event_cb = isdn_tty_event_callback;
...@@ -1018,7 +1016,6 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg) ...@@ -1018,7 +1016,6 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg)
isdn_tty_modem_result(RESULT_NO_DIALTONE, info); isdn_tty_modem_result(RESULT_NO_DIALTONE, info);
} else { } else {
info->isdn_slot = slot; info->isdn_slot = slot;
isdn_slot_set_m_idx(slot, info->line);
slot->usage |= ISDN_USAGE_MODEM; slot->usage |= ISDN_USAGE_MODEM;
slot->priv = info; slot->priv = info;
slot->event_cb = isdn_tty_event_callback; slot->event_cb = isdn_tty_event_callback;
...@@ -2133,6 +2130,8 @@ isdn_tty_init(void) ...@@ -2133,6 +2130,8 @@ isdn_tty_init(void)
init_timer(&info->read_timer); init_timer(&info->read_timer);
info->read_timer.data = (unsigned long) info; info->read_timer.data = (unsigned long) info;
info->read_timer.function = isdn_tty_readmodem; 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); skb_queue_head_init(&info->rpqueue);
info->xmit_size = ISDN_SERIAL_XMIT_SIZE; info->xmit_size = ISDN_SERIAL_XMIT_SIZE;
skb_queue_head_init(&info->xmit_queue); skb_queue_head_init(&info->xmit_queue);
...@@ -2301,7 +2300,6 @@ isdn_tty_find_icall(struct isdn_slot *slot, setup_parm *setup) ...@@ -2301,7 +2300,6 @@ isdn_tty_find_icall(struct isdn_slot *slot, setup_parm *setup)
wret = matchret; wret = matchret;
if (!matchret) { /* EAZ is matching */ if (!matchret) { /* EAZ is matching */
info->isdn_slot = slot; info->isdn_slot = slot;
isdn_slot_set_m_idx(slot, info->line);
slot->usage |= isdn_calc_usage(si1, info->emu.mdmreg[REG_L2PROT]); slot->usage |= isdn_calc_usage(si1, info->emu.mdmreg[REG_L2PROT]);
slot->priv = info; slot->priv = info;
slot->event_cb = isdn_tty_event_callback; slot->event_cb = isdn_tty_event_callback;
...@@ -2740,7 +2738,7 @@ isdn_tty_modem_result(int code, modem_info * info) ...@@ -2740,7 +2738,7 @@ isdn_tty_modem_result(int code, modem_info * info)
/* print CID, _before_ _every_ ring */ /* print CID, _before_ _every_ ring */
if (!(m->mdmreg[REG_CIDONCE] & BIT_CIDONCE)) { if (!(m->mdmreg[REG_CIDONCE] & BIT_CIDONCE)) {
isdn_tty_at_cout("\r\nCALLER NUMBER: ", info); 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) { if (m->mdmreg[REG_CDN] & BIT_CDN) {
isdn_tty_at_cout("\r\nCALLED NUMBER: ", info); isdn_tty_at_cout("\r\nCALLED NUMBER: ", info);
isdn_tty_at_cout(info->emu.cpn, info); isdn_tty_at_cout(info->emu.cpn, info);
...@@ -2769,7 +2767,7 @@ isdn_tty_modem_result(int code, modem_info * info) ...@@ -2769,7 +2767,7 @@ isdn_tty_modem_result(int code, modem_info * info)
(m->mdmreg[REG_RINGCNT] == 1)) { (m->mdmreg[REG_RINGCNT] == 1)) {
isdn_tty_at_cout("\r\n", info); isdn_tty_at_cout("\r\n", info);
isdn_tty_at_cout("CALLER NUMBER: ", 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) { if (m->mdmreg[REG_CDN] & BIT_CDN) {
isdn_tty_at_cout("\r\nCALLED NUMBER: ", info); isdn_tty_at_cout("\r\nCALLED NUMBER: ", info);
isdn_tty_at_cout(info->emu.cpn, info); isdn_tty_at_cout(info->emu.cpn, info);
...@@ -3281,7 +3279,7 @@ isdn_tty_cmd_ATA(modem_info * info) ...@@ -3281,7 +3279,7 @@ isdn_tty_cmd_ATA(modem_info * info)
if (info->msr & UART_MSR_RI) { if (info->msr & UART_MSR_RI) {
/* Accept incoming call */ /* Accept incoming call */
info->last_dir = 0; 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; m->mdmreg[REG_RINGCNT] = 0;
info->msr &= ~UART_MSR_RI; info->msr &= ~UART_MSR_RI;
l2 = m->mdmreg[REG_L2PROT]; l2 = m->mdmreg[REG_L2PROT];
......
...@@ -360,10 +360,8 @@ isdn_tty_cmd_FCLASS1(char **p, modem_info * info) ...@@ -360,10 +360,8 @@ isdn_tty_cmd_FCLASS1(char **p, modem_info * info)
PARSE_ERROR1; PARSE_ERROR1;
} }
info->isdn_slot = slot; info->isdn_slot = slot;
isdn_slot_set_m_idx(slot, info->line);
isdn_slot_command(slot, ISDN_CMD_FAXCMD, &c); isdn_slot_command(slot, ISDN_CMD_FAXCMD, &c);
isdn_slot_free(slot); isdn_slot_free(slot);
isdn_slot_set_m_idx(slot, -1);
info->isdn_slot = NULL; info->isdn_slot = NULL;
restore_flags(flags); restore_flags(flags);
} else { } else {
......
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