Commit 59c28988 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: stat_callback() and recv_callback() -> event_callback()

Merge the two different types of callbacks into just one, there's no
good reasons for the receive callback to be different, in particular since
we pass things through the same state machine later anyway.
parent 307dd059
......@@ -45,18 +45,6 @@ static struct isdn_slot slots[ISDN_MAX_CHANNELS];
static struct fsm slot_fsm;
static void slot_debug(struct fsm_inst *fi, char *fmt, ...);
enum {
ST_SLOT_NULL,
ST_SLOT_BOUND,
ST_SLOT_IN,
ST_SLOT_WAIT_DCONN,
ST_SLOT_DCONN,
ST_SLOT_WAIT_BCONN,
ST_SLOT_ACTIVE,
ST_SLOT_WAIT_BHUP,
ST_SLOT_WAIT_DHUP,
};
static char *slot_st_str[] = {
"ST_SLOT_NULL",
"ST_SLOT_BOUND",
......@@ -69,38 +57,22 @@ static char *slot_st_str[] = {
"ST_SLOT_WAIT_DHUP",
};
enum {
EV_DRV_REGISTER,
EV_STAT_RUN,
EV_STAT_STOP,
EV_STAT_UNLOAD,
EV_STAT_STAVAIL,
EV_STAT_ADDCH,
EV_STAT_ICALL,
EV_STAT_DCONN,
EV_STAT_BCONN,
EV_STAT_BHUP,
EV_STAT_DHUP,
EV_STAT_BSENT,
EV_STAT_CINF,
EV_STAT_CAUSE,
EV_STAT_DISPLAY,
EV_STAT_FAXIND,
EV_STAT_AUDIO,
EV_CMD_CLREAZ,
EV_CMD_SETEAZ,
EV_CMD_SETL2,
EV_CMD_SETL3,
EV_CMD_DIAL,
EV_CMD_ACCEPTD,
EV_CMD_ACCEPTB,
EV_CMD_HANGUP,
EV_DATA_REQ,
EV_DATA_IND,
EV_SLOT_BIND,
EV_SLOT_UNBIND,
struct isdn_slot {
int di; /* driver index */
struct isdn_driver *drv; /* driver */
int ch; /* channel index (per driver) */
int usage; /* how is it used */
char num[ISDN_MSNLEN]; /* the current phone number */
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)(int sl, int pr, void *arg);
struct fsm_inst fi;
};
static char *ev_str[] = {
"EV_DRV_REGISTER",
"EV_STAT_RUN",
......@@ -133,38 +105,22 @@ static char *ev_str[] = {
"EV_SLOT_UNBIND",
};
struct isdn_slot {
int di; /* driver index */
struct isdn_driver *drv; /* driver */
int ch; /* channel index (per driver) */
int usage; /* how is it used */
char num[ISDN_MSNLEN]; /* the current phone number */
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 (*stat_cb)(int sl, isdn_ctrl *ctrl);
int (*recv_cb)(int sl, struct sk_buff *skb);
struct fsm_inst fi;
};
static int __slot_command(struct isdn_slot *slot, isdn_ctrl *cmd);
static void isdn_v110_setl2(struct isdn_slot *slot, isdn_ctrl *cmd);
static void __isdn_v110_open(struct isdn_slot *slot);
static void __isdn_v110_close(struct isdn_slot *slot);
static void __isdn_v110_bsent(struct isdn_slot *slot, isdn_ctrl *cmd);
static void __isdn_v110_bsent(struct isdn_slot *slot, int pr, isdn_ctrl *cmd);
static int isdn_v110_data_ind(struct isdn_slot *slot, struct sk_buff *skb);
static int isdn_v110_data_req(struct isdn_slot *slot, struct sk_buff *skb);
static inline int
do_stat_cb(struct isdn_slot *slot, isdn_ctrl *ctrl)
do_event_cb(struct isdn_slot *slot, int pr, void *arg)
{
int sl = slot - slots;
if (slot->stat_cb)
return slot->stat_cb(sl, ctrl);
if (slot->event_cb)
return slot->event_cb(sl, pr, arg);
return -ENXIO;
}
......@@ -192,9 +148,8 @@ static int
slot_stat(struct fsm_inst *fi, int pr, void *arg)
{
struct isdn_slot *slot = fi->userdata;
isdn_ctrl *ctrl = arg;
do_stat_cb(slot, ctrl);
do_event_cb(slot, pr, arg);
return 0;
}
......@@ -270,10 +225,9 @@ static int
slot_dconn(struct fsm_inst *fi, int pr, void *arg)
{
struct isdn_slot *slot = fi->userdata;
isdn_ctrl *ctrl = arg;
fsm_change_state(fi, ST_SLOT_DCONN);
do_stat_cb(slot, ctrl);
do_event_cb(slot, pr, arg);
return 0;
}
......@@ -281,14 +235,13 @@ static int
slot_bconn(struct fsm_inst *fi, int pr, void *arg)
{
struct isdn_slot *slot = fi->userdata;
isdn_ctrl *ctrl = arg;
fsm_change_state(fi, ST_SLOT_ACTIVE);
__isdn_v110_open(slot);
isdn_info_update();
do_stat_cb(slot, ctrl);
do_event_cb(slot, pr, arg);
return 0;
}
......@@ -296,12 +249,11 @@ static int
slot_bhup(struct fsm_inst *fi, int pr, void *arg)
{
struct isdn_slot *slot = fi->userdata;
isdn_ctrl *ctrl = arg;
__isdn_v110_close(slot);
fsm_change_state(fi, ST_SLOT_WAIT_DHUP);
do_stat_cb(slot, ctrl);
do_event_cb(slot, pr, arg);
return 0;
}
......@@ -309,11 +261,10 @@ static int
slot_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_BOUND);
do_stat_cb(slot, ctrl);
do_event_cb(slot, pr, arg);
return 0;
}
......@@ -344,7 +295,7 @@ slot_bsent(struct fsm_inst *fi, int pr, void *arg)
struct isdn_slot *slot = fi->userdata;
isdn_ctrl *ctrl = arg;
__isdn_v110_bsent(slot, ctrl);
__isdn_v110_bsent(slot, pr, ctrl);
return 0;
}
......@@ -381,10 +332,9 @@ 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);
do_event_cb(slot, pr, arg);
return 0;
}
......@@ -2364,16 +2314,14 @@ isdn_slot_num(int sl)
void
isdn_slot_set_priv(int sl, int usage, void *priv,
int (*stat_cb)(int sl, isdn_ctrl *ctrl),
int (*recv_cb)(int sl, struct sk_buff *skb))
int (*event_cb)(int sl, int pr, void *arg))
{
BUG_ON(sl < 0);
slots[sl].usage &= ISDN_USAGE_EXCLUSIVE;
slots[sl].usage |= usage;
slots[sl].priv = priv;
slots[sl].stat_cb = stat_cb;
slots[sl].recv_cb = recv_cb;
slots[sl].event_cb = event_cb;
}
void *
......@@ -2620,12 +2568,12 @@ __isdn_v110_close(struct isdn_slot *slot)
}
static void
__isdn_v110_bsent(struct isdn_slot *slot, isdn_ctrl *c)
__isdn_v110_bsent(struct isdn_slot *slot, int pr, isdn_ctrl *c)
{
int sl = slot - slots;
if (!slot->iv110.v110emu) {
do_stat_cb(slot, c);
do_event_cb(slot, pr, c);
return;
}
isdn_v110_bsent(sl, &slot->iv110);
......@@ -2677,7 +2625,8 @@ isdn_v110_data_ind(struct isdn_slot *slot, struct sk_buff *skb)
return 0;
recv:
slot->recv_cb(sl, skb);
if (slot->event_cb)
slot->event_cb(sl, EV_DATA_IND, skb);
return 0;
}
......
......@@ -90,9 +90,54 @@ extern int isdn_slot_usage(int slot);
extern char *isdn_slot_num(int slot);
extern int isdn_slot_m_idx(int slot);
extern void isdn_slot_set_m_idx(int slot, int midx);
extern void isdn_slot_set_priv(int sl, int usage, void *priv, int (*stat_cb)(int sl, isdn_ctrl *ctrl), int (*recv_cb)(int sl, struct sk_buff *skb));
extern void isdn_slot_set_priv(int sl, int usage, void *priv,
int (*event_cb)(int sl, int pr, void *arg));
extern void *isdn_slot_priv(int sl);
extern int isdn_hard_header_len(void);
int isdn_drv_lookup(char *drvid);
char *isdn_drv_drvid(int di);
enum {
ST_SLOT_NULL,
ST_SLOT_BOUND,
ST_SLOT_IN,
ST_SLOT_WAIT_DCONN,
ST_SLOT_DCONN,
ST_SLOT_WAIT_BCONN,
ST_SLOT_ACTIVE,
ST_SLOT_WAIT_BHUP,
ST_SLOT_WAIT_DHUP,
};
enum {
EV_DRV_REGISTER,
EV_STAT_RUN,
EV_STAT_STOP,
EV_STAT_UNLOAD,
EV_STAT_STAVAIL,
EV_STAT_ADDCH,
EV_STAT_ICALL,
EV_STAT_DCONN,
EV_STAT_BCONN,
EV_STAT_BHUP,
EV_STAT_DHUP,
EV_STAT_BSENT,
EV_STAT_CINF,
EV_STAT_CAUSE,
EV_STAT_DISPLAY,
EV_STAT_FAXIND,
EV_STAT_AUDIO,
EV_CMD_CLREAZ,
EV_CMD_SETEAZ,
EV_CMD_SETL2,
EV_CMD_SETL3,
EV_CMD_DIAL,
EV_CMD_ACCEPTD,
EV_CMD_ACCEPTB,
EV_CMD_HANGUP,
EV_DATA_REQ,
EV_DATA_IND,
EV_SLOT_BIND,
EV_SLOT_UNBIND,
};
......@@ -128,21 +128,21 @@ static char *isdn_net_st_str[] = {
};
enum {
EV_TIMER_INCOMING,
EV_TIMER_DIAL,
EV_TIMER_DIAL_WAIT,
EV_TIMER_CB_OUT,
EV_TIMER_CB_IN,
EV_TIMER_HUP,
EV_STAT_DCONN,
EV_STAT_BCONN,
EV_STAT_DHUP,
EV_STAT_BHUP,
EV_STAT_CINF,
EV_STAT_BSENT,
EV_DO_DIAL,
EV_DO_CALLBACK,
EV_DO_ACCEPT,
EV_NET_TIMER_INCOMING,
EV_NET_TIMER_DIAL,
EV_NET_TIMER_DIAL_WAIT,
EV_NET_TIMER_CB_OUT,
EV_NET_TIMER_CB_IN,
EV_NET_TIMER_HUP,
EV_NET_STAT_DCONN,
EV_NET_STAT_BCONN,
EV_NET_STAT_DHUP,
EV_NET_STAT_BHUP,
EV_NET_STAT_CINF,
EV_NET_STAT_BSENT,
EV_NET_DO_DIAL,
EV_NET_DO_CALLBACK,
EV_NET_DO_ACCEPT,
};
static char *isdn_net_ev_str[] = {
......@@ -152,15 +152,15 @@ static char *isdn_net_ev_str[] = {
"EV_NET_TIMER_CB_OUT",
"EV_NET_TIMER_CB_IN",
"EV_NET_TIMER_HUP",
"EV_STAT_DCONN",
"EV_STAT_BCONN",
"EV_STAT_DHUP",
"EV_STAT_BHUP",
"EV_STAT_CINF",
"EV_STAT_BSENT",
"EV_DO_DIAL",
"EV_DO_CALLBACK",
"EV_DO_ACCEPT",
"EV_NET_STAT_DCONN",
"EV_NET_STAT_BCONN",
"EV_NET_STAT_DHUP",
"EV_NET_STAT_BHUP",
"EV_NET_STAT_CINF",
"EV_NET_STAT_BSENT",
"EV_NET_DO_DIAL",
"EV_NET_DO_CALLBACK",
"EV_NET_DO_ACCEPT",
};
/* Definitions for hupflags: */
......@@ -1202,7 +1202,7 @@ isdn_net_unbind_channel(isdn_net_dev *idev)
if (mlp->ops->unbind)
mlp->ops->unbind(idev);
isdn_slot_set_priv(idev->isdn_slot, 0, NULL, NULL, NULL);
isdn_slot_set_priv(idev->isdn_slot, 0, NULL, NULL);
skb_queue_purge(&idev->super_tx_queue);
......@@ -1217,8 +1217,7 @@ isdn_net_unbind_channel(isdn_net_dev *idev)
}
}
static int isdn_net_stat_callback(int, isdn_ctrl *);
static int isdn_net_rcv_skb(int, struct sk_buff *);
static int isdn_net_event_callback(int sl, int pr, void *arg);
/*
* Assign an ISDN-channel to a net-interface
......@@ -1231,7 +1230,7 @@ isdn_net_bind_channel(isdn_net_dev *idev, int slot)
idev->isdn_slot = slot;
isdn_slot_set_priv(idev->isdn_slot, ISDN_USAGE_NET, idev,
isdn_net_stat_callback, isdn_net_rcv_skb);
isdn_net_event_callback);
if (mlp->ops->bind)
retval = mlp->ops->bind(idev);
......@@ -1248,7 +1247,7 @@ isdn_net_dial(isdn_net_dev *idev)
int retval;
lp_get(idev->mlp);
retval = fsm_event(&idev->fi, EV_DO_DIAL, NULL);
retval = fsm_event(&idev->fi, EV_NET_DO_DIAL, NULL);
if (retval == -ESRCH) /* event not handled in this state */
retval = -EBUSY;
......@@ -1385,7 +1384,7 @@ accept_icall(struct fsm_inst *fi, int pr, void *arg)
isdn_slot_command(idev->isdn_slot, ISDN_CMD_ACCEPTD, &cmd);
idev->dial_timer.expires = jiffies + mlp->dialtimeout;
idev->dial_event = EV_TIMER_INCOMING;
idev->dial_event = EV_NET_TIMER_INCOMING;
add_timer(&idev->dial_timer);
fsm_change_state(&idev->fi, ST_IN_WAIT_DCONN);
return 0;
......@@ -1400,7 +1399,7 @@ do_callback(struct fsm_inst *fi, int pr, void *arg)
printk(KERN_DEBUG "%s: start callback\n", idev->name);
idev->dial_timer.expires = jiffies + mlp->cbdelay;
idev->dial_event = EV_TIMER_CB_IN;
idev->dial_event = EV_NET_TIMER_CB_IN;
add_timer(&idev->dial_timer);
fsm_change_state(&idev->fi, ST_WAIT_BEFORE_CB);
......@@ -1467,7 +1466,7 @@ isdn_net_dev_icall(isdn_net_dev *idev, int slot, int di, int ch, int si1,
lp_get(mlp);
/* check callback */
if (mlp->flags & ISDN_NET_CALLBACK) {
if (fsm_event(&idev->fi, EV_DO_CALLBACK, NULL)) {
if (fsm_event(&idev->fi, EV_NET_DO_CALLBACK, NULL)) {
lp_put(mlp);
return 0;
}
......@@ -1477,7 +1476,7 @@ isdn_net_dev_icall(isdn_net_dev *idev, int slot, int di, int ch, int si1,
printk(KERN_INFO "%s: call from %s -> %s accepted\n",
idev->name, nr, eaz);
if (fsm_event(&idev->fi, EV_DO_ACCEPT, (void *) slot)) {
if (fsm_event(&idev->fi, EV_NET_DO_ACCEPT, (void *) slot)) {
lp_put(mlp);
return 0;
}
......@@ -1659,10 +1658,10 @@ dialout_next(struct fsm_inst *fi, int pr, void *arg)
/* For outgoing callback, use cbdelay instead of dialtimeout */
if (mlp->cbdelay && (mlp->flags & ISDN_NET_CBOUT)) {
idev->dial_timer.expires = jiffies + mlp->cbdelay;
idev->dial_event = EV_TIMER_CB_OUT;
idev->dial_event = EV_NET_TIMER_CB_OUT;
} else {
idev->dial_timer.expires = jiffies + mlp->dialtimeout;
idev->dial_event = EV_TIMER_DIAL;
idev->dial_event = EV_NET_TIMER_DIAL;
}
fsm_change_state(&idev->fi, ST_OUT_WAIT_DCONN);
add_timer(&idev->dial_timer);
......@@ -1695,7 +1694,7 @@ dial_timeout(struct fsm_inst *fi, int pr, void *arg)
isdn_net_hangup(idev);
return 0;
}
idev->dial_event = EV_TIMER_DIAL_WAIT;
idev->dial_event = EV_NET_TIMER_DIAL_WAIT;
mod_timer(&idev->dial_timer, jiffies + mlp->dialwait);
return 0;
}
......@@ -1743,7 +1742,7 @@ bconn(struct fsm_inst *fi, int pr, void *arg)
if (mlp->onhtime) {
idev->huptimer = 0;
idev->dial_event = EV_TIMER_HUP;
idev->dial_event = EV_NET_TIMER_HUP;
mod_timer(&idev->dial_timer, jiffies + HZ);
} else {
del_timer(&idev->dial_timer);
......@@ -1862,35 +1861,38 @@ isdn_net_hangup(isdn_net_dev *idev)
return 1;
}
static int isdn_net_rcv_skb(int idx, struct sk_buff *skb);
/*
* Handle status-messages from ISDN-interfacecard.
* This function is called from within the main-status-dispatcher
* isdn_status_callback, which itself is called from the low-level driver.
* Return: 1 = event handled, 0 = not handled
*/
static int
isdn_net_stat_callback(int idx, isdn_ctrl *c)
isdn_net_event_callback(int sl, int pr, void *arg)
{
isdn_net_dev *idev = isdn_slot_priv(idx);
isdn_net_dev *idev = isdn_slot_priv(sl);
if (!idev) {
if (!idev)
return 0;
}
switch (c->command) {
case ISDN_STAT_DCONN:
return fsm_event(&idev->fi, EV_STAT_DCONN, c);
case ISDN_STAT_BCONN:
return fsm_event(&idev->fi, EV_STAT_BCONN, c);
case ISDN_STAT_BHUP:
return fsm_event(&idev->fi, EV_STAT_BHUP, c);
case ISDN_STAT_DHUP:
return fsm_event(&idev->fi, EV_STAT_DHUP, c);
case ISDN_STAT_CINF:
return fsm_event(&idev->fi, EV_STAT_CINF, c);
case ISDN_STAT_BSENT:
return fsm_event(&idev->fi, EV_STAT_BSENT, c);
switch (pr) {
case EV_DATA_IND:
return isdn_net_rcv_skb(sl, arg);
case EV_STAT_DCONN:
return fsm_event(&idev->fi, EV_NET_STAT_DCONN, arg);
case EV_STAT_BCONN:
return fsm_event(&idev->fi, EV_NET_STAT_BCONN, arg);
case EV_STAT_BHUP:
return fsm_event(&idev->fi, EV_NET_STAT_BHUP, arg);
case EV_STAT_DHUP:
return fsm_event(&idev->fi, EV_NET_STAT_DHUP, arg);
case EV_STAT_CINF:
return fsm_event(&idev->fi, EV_NET_STAT_CINF, arg);
case EV_STAT_BSENT:
return fsm_event(&idev->fi, EV_NET_STAT_BSENT, arg);
default:
printk("unknown stat %d\n", c->command);
printk("unknown pr %d\n", pr);
return 0;
}
}
......@@ -1921,37 +1923,37 @@ got_bsent(struct fsm_inst *fi, int pr, void *arg)
}
static struct fsm_node isdn_net_fn_tbl[] = {
{ ST_NULL, EV_DO_DIAL, do_dial },
{ ST_NULL, EV_DO_ACCEPT, accept_icall },
{ ST_NULL, EV_DO_CALLBACK, do_callback },
{ ST_NULL, EV_NET_DO_DIAL, do_dial },
{ ST_NULL, EV_NET_DO_ACCEPT, accept_icall },
{ ST_NULL, EV_NET_DO_CALLBACK, do_callback },
{ ST_OUT_WAIT_DCONN, EV_TIMER_DIAL, dial_timeout },
{ ST_OUT_WAIT_DCONN, EV_STAT_DCONN, out_dconn },
{ ST_OUT_WAIT_DCONN, EV_STAT_DHUP, connect_fail },
{ ST_OUT_WAIT_DCONN, EV_TIMER_CB_OUT, hang_up },
{ ST_OUT_WAIT_DCONN, EV_NET_TIMER_DIAL, dial_timeout },
{ ST_OUT_WAIT_DCONN, EV_NET_STAT_DCONN, out_dconn },
{ ST_OUT_WAIT_DCONN, EV_NET_STAT_DHUP, connect_fail },
{ ST_OUT_WAIT_DCONN, EV_NET_TIMER_CB_OUT, hang_up },
{ ST_OUT_WAIT_BCONN, EV_TIMER_DIAL, dial_timeout },
{ ST_OUT_WAIT_BCONN, EV_STAT_BCONN, bconn },
{ ST_OUT_WAIT_BCONN, EV_STAT_DHUP, connect_fail },
{ ST_OUT_WAIT_BCONN, EV_NET_TIMER_DIAL, dial_timeout },
{ ST_OUT_WAIT_BCONN, EV_NET_STAT_BCONN, bconn },
{ ST_OUT_WAIT_BCONN, EV_NET_STAT_DHUP, connect_fail },
{ ST_IN_WAIT_DCONN, EV_TIMER_INCOMING, hang_up },
{ ST_IN_WAIT_DCONN, EV_STAT_DCONN, in_dconn },
{ ST_IN_WAIT_DCONN, EV_STAT_DHUP, connect_fail },
{ ST_IN_WAIT_DCONN, EV_NET_TIMER_INCOMING, hang_up },
{ ST_IN_WAIT_DCONN, EV_NET_STAT_DCONN, in_dconn },
{ ST_IN_WAIT_DCONN, EV_NET_STAT_DHUP, connect_fail },
{ ST_IN_WAIT_BCONN, EV_TIMER_INCOMING, hang_up },
{ ST_IN_WAIT_BCONN, EV_STAT_BCONN, bconn },
{ ST_IN_WAIT_BCONN, EV_STAT_DHUP, connect_fail },
{ ST_IN_WAIT_BCONN, EV_NET_TIMER_INCOMING, hang_up },
{ ST_IN_WAIT_BCONN, EV_NET_STAT_BCONN, bconn },
{ ST_IN_WAIT_BCONN, EV_NET_STAT_DHUP, connect_fail },
{ ST_ACTIVE, EV_TIMER_HUP, check_hup },
{ ST_ACTIVE, EV_STAT_BHUP, bhup },
{ ST_ACTIVE, EV_STAT_CINF, got_cinf },
{ ST_ACTIVE, EV_STAT_BSENT, got_bsent },
{ ST_ACTIVE, EV_NET_TIMER_HUP, check_hup },
{ ST_ACTIVE, EV_NET_STAT_BHUP, bhup },
{ ST_ACTIVE, EV_NET_STAT_CINF, got_cinf },
{ ST_ACTIVE, EV_NET_STAT_BSENT, got_bsent },
{ ST_WAIT_DHUP, EV_STAT_DHUP, dhup },
{ ST_WAIT_DHUP, EV_NET_STAT_DHUP, dhup },
{ ST_WAIT_BEFORE_CB, EV_TIMER_CB_IN, do_dial },
{ ST_WAIT_BEFORE_CB, EV_NET_TIMER_CB_IN, do_dial },
{ ST_OUT_DIAL_WAIT, EV_TIMER_DIAL_WAIT, dialout_next },
{ ST_OUT_DIAL_WAIT, EV_NET_TIMER_DIAL_WAIT, dialout_next },
};
static struct fsm isdn_net_fsm = {
......
......@@ -32,10 +32,22 @@ static void isdn_tty_cmd_ATA(modem_info *);
static void isdn_tty_flush_buffer(struct tty_struct *);
static void isdn_tty_modem_result(int, modem_info *);
static int isdn_tty_stat_callback(int i, isdn_ctrl *c);
static int isdn_tty_rcv_skb(int i, struct sk_buff *skb);
#ifdef CONFIG_ISDN_AUDIO
static int isdn_tty_countDLE(unsigned char *, int);
#endif
static int
isdn_tty_event_callback(int sl, int pr, void *arg)
{
switch (pr) {
case EV_DATA_IND:
return isdn_tty_rcv_skb(sl, arg);
default:
return isdn_tty_stat_callback(sl, arg);
}
}
/* Leave this unchanged unless you know what you do! */
#define MODEM_PARANOIA_CHECK
#define MODEM_DO_RESTART
......@@ -755,7 +767,7 @@ isdn_tty_dial(char *n, modem_info * info, atemu * m)
info->isdn_slot = i;
isdn_slot_set_m_idx(i, info->line);
isdn_slot_set_priv(i, ISDN_USAGE_MODEM, info, isdn_tty_stat_callback, isdn_tty_rcv_skb);
isdn_slot_set_priv(i, ISDN_USAGE_MODEM, info, isdn_tty_event_callback);
info->last_dir = 1;
info->last_l2 = l2;
strcpy(info->last_num, n);
......@@ -837,7 +849,7 @@ isdn_tty_modem_hup(modem_info * info, int local)
info->emu.mdmreg[REG_RINGCNT] = 0;
skb_queue_purge(&info->rpqueue);
isdn_slot_free(slot);
isdn_slot_set_priv(slot, 0, NULL, NULL, NULL);
isdn_slot_set_priv(slot, 0, NULL, NULL);
info->isdn_slot = -1;
}
......@@ -930,7 +942,7 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m)
} else {
info->isdn_slot = i;
isdn_slot_set_m_idx(i, info->line);
isdn_slot_set_priv(i, ISDN_USAGE_MODEM, info, isdn_tty_stat_callback, isdn_tty_rcv_skb);
isdn_slot_set_priv(i, ISDN_USAGE_MODEM, info, isdn_tty_event_callback);
info->last_dir = 1;
// strcpy(info->last_num, n);
restore_flags(flags);
......@@ -1005,7 +1017,7 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg)
} else {
info->isdn_slot = i;
isdn_slot_set_m_idx(i, info->line);
isdn_slot_set_priv(i, ISDN_USAGE_MODEM, info, isdn_tty_stat_callback, isdn_tty_rcv_skb);
isdn_slot_set_priv(i, ISDN_USAGE_MODEM, info, isdn_tty_event_callback);
info->last_dir = 1;
restore_flags(flags);
info->last_l2 = l2;
......@@ -2282,7 +2294,7 @@ isdn_tty_find_icall(int di, int ch, int sl, setup_parm *setup)
if (!matchret) { /* EAZ is matching */
info->isdn_slot = sl;
isdn_slot_set_m_idx(sl, info->line);
isdn_slot_set_priv(sl, isdn_calc_usage(si1, info->emu.mdmreg[REG_L2PROT]), info, isdn_tty_stat_callback, isdn_tty_rcv_skb);
isdn_slot_set_priv(sl, isdn_calc_usage(si1, info->emu.mdmreg[REG_L2PROT]), info, isdn_tty_event_callback);
strcpy(isdn_slot_num(sl), nr);
strcpy(info->emu.cpn, eaz);
info->emu.mdmreg[REG_SI1I] = si2bit[si1];
......
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