Commit 307dd059 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Remove isdn_dc2minor(), isdn_slot_all_eaz()

The internal driver/channel relations shouldn't leak out to users
of the ISDN code, and isdn_slot_all_eaz() can be taken over by common
code as well.
parent b875e2fa
...@@ -392,8 +392,12 @@ static int ...@@ -392,8 +392,12 @@ static int
slot_unbind(struct fsm_inst *fi, int pr, void *arg) slot_unbind(struct fsm_inst *fi, int pr, void *arg)
{ {
struct isdn_slot *slot = fi->userdata; struct isdn_slot *slot = fi->userdata;
int sl = slot - slots;
isdn_ctrl cmd;
strcpy(slot->num, "???"); strcpy(slot->num, "???");
cmd.parm.num[0] = '\0';
isdn_slot_command(sl, ISDN_CMD_SETEAZ, &cmd);
slot->ibytes = 0; slot->ibytes = 0;
slot->obytes = 0; slot->obytes = 0;
slot->usage = ISDN_USAGE_NONE; slot->usage = ISDN_USAGE_NONE;
...@@ -636,6 +640,7 @@ set_global_features(void) ...@@ -636,6 +640,7 @@ set_global_features(void)
static int isdn_add_channels(struct isdn_driver *, int, int, int); static int isdn_add_channels(struct isdn_driver *, int, int, int);
static void isdn_receive_skb_callback(int di, int ch, struct sk_buff *skb); static void isdn_receive_skb_callback(int di, int ch, struct sk_buff *skb);
static int isdn_status_callback(isdn_ctrl * c); static int isdn_status_callback(isdn_ctrl * c);
static int isdn_dc2minor(int di, int ch);
static void isdn_v110_add_features(struct isdn_driver *drv); static void isdn_v110_add_features(struct isdn_driver *drv);
...@@ -1211,7 +1216,7 @@ int isdn_msncmp( const char * msn1, const char * msn2 ) ...@@ -1211,7 +1216,7 @@ int isdn_msncmp( const char * msn1, const char * msn2 )
return isdn_wildmat( TmpMsn1, TmpMsn2 ); return isdn_wildmat( TmpMsn1, TmpMsn2 );
} }
int static int
isdn_dc2minor(int di, int ch) isdn_dc2minor(int di, int ch)
{ {
int i; int i;
...@@ -2084,15 +2089,6 @@ isdn_get_free_slot(int usage, int l2_proto, int l3_proto, ...@@ -2084,15 +2089,6 @@ isdn_get_free_slot(int usage, int l2_proto, int l3_proto,
/* /*
* Set state of ISDN-channel to 'unused' * Set state of ISDN-channel to 'unused'
*/ */
void
isdn_free_channel(int di, int ch, int usage)
{
int sl;
sl = isdn_dc2minor(di, ch);
isdn_slot_free(sl);
}
void void
isdn_slot_free(int sl) isdn_slot_free(int sl)
{ {
...@@ -2334,15 +2330,6 @@ isdn_slot_dial(int sl, struct dial_info *dial) ...@@ -2334,15 +2330,6 @@ isdn_slot_dial(int sl, struct dial_info *dial)
return isdn_slot_command(sl, ISDN_CMD_DIAL, &cmd); return isdn_slot_command(sl, ISDN_CMD_DIAL, &cmd);
} }
void
isdn_slot_all_eaz(int sl)
{
isdn_ctrl cmd;
cmd.parm.num[0] = '\0';
isdn_slot_command(sl, ISDN_CMD_SETEAZ, &cmd);
}
int int
isdn_slot_usage(int sl) isdn_slot_usage(int sl)
{ {
......
...@@ -57,7 +57,6 @@ extern void isdn_MOD_DEC_USE_COUNT(void); ...@@ -57,7 +57,6 @@ 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_free_channel(int di, int ch, int usage);
extern int isdn_dc2minor(int di, int ch);
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 void isdn_timer_ctrl(int tf, int onoff); extern void isdn_timer_ctrl(int tf, int onoff);
...@@ -81,7 +80,6 @@ struct dial_info { ...@@ -81,7 +80,6 @@ struct dial_info {
extern int isdn_get_free_slot(int, int, int, int, int, char *); extern int isdn_get_free_slot(int, int, int, int, int, char *);
extern void isdn_slot_free(int slot); extern void isdn_slot_free(int slot);
extern void isdn_slot_all_eaz(int slot);
extern int isdn_slot_command(int slot, int cmd, isdn_ctrl *); extern int isdn_slot_command(int slot, int cmd, isdn_ctrl *);
extern int isdn_slot_dial(int slot, struct dial_info *dial); extern int isdn_slot_dial(int slot, struct dial_info *dial);
extern char *isdn_slot_map_eaz2msn(int slot, char *msn); extern char *isdn_slot_map_eaz2msn(int slot, char *msn);
......
...@@ -1408,12 +1408,11 @@ do_callback(struct fsm_inst *fi, int pr, void *arg) ...@@ -1408,12 +1408,11 @@ do_callback(struct fsm_inst *fi, int pr, void *arg)
} }
static int static int
isdn_net_dev_icall(isdn_net_dev *idev, int di, int ch, int si1, isdn_net_dev_icall(isdn_net_dev *idev, int slot, int di, int ch, int si1,
char *eaz, char *nr) char *eaz, char *nr)
{ {
isdn_net_local *mlp = idev->mlp; isdn_net_local *mlp = idev->mlp;
struct isdn_net_phone *ph; struct isdn_net_phone *ph;
int slot = isdn_dc2minor(di, ch);
char *my_eaz; char *my_eaz;
/* check acceptable call types for DOV */ /* check acceptable call types for DOV */
...@@ -1502,7 +1501,7 @@ isdn_net_dev_icall(isdn_net_dev *idev, int di, int ch, int si1, ...@@ -1502,7 +1501,7 @@ isdn_net_dev_icall(isdn_net_dev *idev, int di, int ch, int si1,
* would eventually match if CID was longer. * would eventually match if CID was longer.
*/ */
int int
isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup) isdn_net_find_icall(int di, int ch, int sl, setup_parm *setup)
{ {
isdn_net_local *lp; isdn_net_local *lp;
isdn_net_dev *idev; isdn_net_dev *idev;
...@@ -1542,8 +1541,8 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup) ...@@ -1542,8 +1541,8 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
return 0; return 0;
} }
dbg_net_icall("n_fi: di=%d ch=%d idx=%d usg=%d\n", di, ch, idx, dbg_net_icall("n_fi: di=%d ch=%d sl=%d usg=%d\n", di, ch, sl,
isdn_slot_usage(idx)); isdn_slot_usage(sl));
retval = 0; retval = 0;
spin_lock_irqsave(&running_devs_lock, flags); spin_lock_irqsave(&running_devs_lock, flags);
...@@ -1552,7 +1551,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup) ...@@ -1552,7 +1551,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
spin_unlock_irqrestore(&running_devs_lock, flags); spin_unlock_irqrestore(&running_devs_lock, flags);
list_for_each_entry(idev, &lp->slaves, slaves) { list_for_each_entry(idev, &lp->slaves, slaves) {
retval = isdn_net_dev_icall(idev, di, ch, si1, eaz, nr); retval = isdn_net_dev_icall(idev, sl, di, ch, si1, eaz, nr);
if (retval > 0) if (retval > 0)
break; break;
} }
...@@ -1707,7 +1706,6 @@ connect_fail(struct fsm_inst *fi, int pr, void *arg) ...@@ -1707,7 +1706,6 @@ connect_fail(struct fsm_inst *fi, int pr, void *arg)
isdn_net_dev *idev = fi->userdata; isdn_net_dev *idev = fi->userdata;
del_timer(&idev->dial_timer); del_timer(&idev->dial_timer);
isdn_slot_all_eaz(idev->isdn_slot);
printk(KERN_INFO "%s: connection failed\n", idev->name); printk(KERN_INFO "%s: connection failed\n", idev->name);
isdn_net_unbind_channel(idev); isdn_net_unbind_channel(idev);
return 0; return 0;
...@@ -1791,7 +1789,6 @@ dhup(struct fsm_inst *fi, int pr, void *arg) ...@@ -1791,7 +1789,6 @@ dhup(struct fsm_inst *fi, int pr, void *arg)
isdn_net_dev *idev = fi->userdata; isdn_net_dev *idev = fi->userdata;
printk(KERN_INFO "%s: Chargesum is %d\n", idev->name, idev->charge); printk(KERN_INFO "%s: Chargesum is %d\n", idev->name, idev->charge);
isdn_slot_all_eaz(idev->isdn_slot);
isdn_net_unbind_channel(idev); isdn_net_unbind_channel(idev);
return 0; return 0;
} }
......
...@@ -834,7 +834,6 @@ isdn_tty_modem_hup(modem_info * info, int local) ...@@ -834,7 +834,6 @@ isdn_tty_modem_hup(modem_info * info, int local)
if (local) if (local)
isdn_slot_command(slot, ISDN_CMD_HANGUP, &cmd); isdn_slot_command(slot, ISDN_CMD_HANGUP, &cmd);
isdn_slot_all_eaz(slot);
info->emu.mdmreg[REG_RINGCNT] = 0; info->emu.mdmreg[REG_RINGCNT] = 0;
skb_queue_purge(&info->rpqueue); skb_queue_purge(&info->rpqueue);
isdn_slot_free(slot); isdn_slot_free(slot);
...@@ -2234,7 +2233,6 @@ isdn_tty_find_icall(int di, int ch, int sl, setup_parm *setup) ...@@ -2234,7 +2233,6 @@ isdn_tty_find_icall(int di, int ch, int sl, setup_parm *setup)
char *eaz; char *eaz;
int i; int i;
int wret; int wret;
int idx;
int si1; int si1;
int si2; int si2;
char *nr; char *nr;
...@@ -2265,10 +2263,9 @@ isdn_tty_find_icall(int di, int ch, int sl, setup_parm *setup) ...@@ -2265,10 +2263,9 @@ isdn_tty_find_icall(int di, int ch, int sl, setup_parm *setup)
continue; continue;
if ((info->emu.mdmreg[REG_SI1] & si2bit[si1]) && /* SI1 is matching */ if ((info->emu.mdmreg[REG_SI1] & si2bit[si1]) && /* SI1 is matching */
(info->emu.mdmreg[REG_SI2] == si2)) { /* SI2 is matching */ (info->emu.mdmreg[REG_SI2] == si2)) { /* SI2 is matching */
idx = isdn_dc2minor(di, ch);
#ifdef ISDN_DEBUG_MODEM_ICALL #ifdef ISDN_DEBUG_MODEM_ICALL
printk(KERN_DEBUG "m_fi: match1 wret=%d\n", wret); printk(KERN_DEBUG "m_fi: match1 wret=%d\n", wret);
printk(KERN_DEBUG "m_fi: idx=%d flags=%08lx drv=%d ch=%d usg=%d\n", idx, printk(KERN_DEBUG "m_fi: sl=%d flags=%08lx drv=%d ch=%d usg=%d\n", sl,
info->flags, info->isdn_driver, info->isdn_channel, info->flags, info->isdn_driver, info->isdn_channel,
dev->usage[idx]); dev->usage[idx]);
#endif #endif
...@@ -2277,16 +2274,16 @@ isdn_tty_find_icall(int di, int ch, int sl, setup_parm *setup) ...@@ -2277,16 +2274,16 @@ isdn_tty_find_icall(int di, int ch, int sl, setup_parm *setup)
(info->flags & ISDN_ASYNC_NORMAL_ACTIVE) && (info->flags & ISDN_ASYNC_NORMAL_ACTIVE) &&
#endif #endif
(info->isdn_slot == -1) && (info->isdn_slot == -1) &&
(USG_NONE(isdn_slot_usage(idx)))) { (USG_NONE(isdn_slot_usage(sl)))) {
int matchret; int matchret;
if ((matchret = isdn_tty_match_icall(eaz, &info->emu, di)) > wret) if ((matchret = isdn_tty_match_icall(eaz, &info->emu, di)) > wret)
wret = matchret; wret = matchret;
if (!matchret) { /* EAZ is matching */ if (!matchret) { /* EAZ is matching */
info->isdn_slot = idx; info->isdn_slot = sl;
isdn_slot_set_m_idx(idx, info->line); isdn_slot_set_m_idx(sl, info->line);
isdn_slot_set_priv(idx, 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_stat_callback, isdn_tty_rcv_skb);
strcpy(isdn_slot_num(idx), nr); strcpy(isdn_slot_num(sl), nr);
strcpy(info->emu.cpn, eaz); strcpy(info->emu.cpn, eaz);
info->emu.mdmreg[REG_SI1I] = si2bit[si1]; info->emu.mdmreg[REG_SI1I] = si2bit[si1];
info->emu.mdmreg[REG_PLAN] = setup->plan; info->emu.mdmreg[REG_PLAN] = setup->plan;
...@@ -2332,15 +2329,12 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c) ...@@ -2332,15 +2329,12 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c)
#ifdef ISDN_TTY_STAT_DEBUG #ifdef ISDN_TTY_STAT_DEBUG
printk(KERN_DEBUG "tty_STAT_BSENT ttyI%d\n", info->line); printk(KERN_DEBUG "tty_STAT_BSENT ttyI%d\n", info->line);
#endif #endif
if ((info->isdn_slot == isdn_dc2minor(c->driver, c->arg))) { info->msr |= UART_MSR_CTS;
info->msr |= UART_MSR_CTS; if (info->send_outstanding)
if (info->send_outstanding) if (!(--info->send_outstanding))
if (!(--info->send_outstanding)) info->lsr |= UART_LSR_TEMT;
info->lsr |= UART_LSR_TEMT; isdn_tty_tint(info);
isdn_tty_tint(info); return 1;
return 1;
}
break;
case ISDN_STAT_CAUSE: case ISDN_STAT_CAUSE:
#ifdef ISDN_TTY_STAT_DEBUG #ifdef ISDN_TTY_STAT_DEBUG
printk(KERN_DEBUG "tty_STAT_CAUSE ttyI%d\n", info->line); printk(KERN_DEBUG "tty_STAT_CAUSE ttyI%d\n", info->line);
......
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