Commit 4a483307 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Remove ttyI specific from global "dev" variable

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