Commit f1f5ccc8 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/HiSax: Move BC_SetStack/BC_Close

Since we now have a per B-channel driver ops structure, start
populating it.
parent 43ec4349
......@@ -204,6 +204,10 @@ hdlc_read_fifo(struct IsdnCardState *cs, int hscx, u8 *data, int len)
}
}
static struct bc_hw_ops hdlc_hw_ops = {
.read_fifo = hdlc_read_fifo,
};
static inline
struct BCState *Sel_BCS(struct IsdnCardState *cs, int channel)
{
......@@ -344,10 +348,6 @@ reset_xmit(struct BCState *bcs)
hdlc_fill_fifo(bcs);
}
static struct bc_l1_ops hdlc_l1_ops = {
.fill_fifo = hdlc_fill_fifo,
};
static inline void
HDLC_irq(struct BCState *bcs, u_int stat)
{
......@@ -491,8 +491,10 @@ setstack_hdlc(struct PStack *st, struct BCState *bcs)
return (0);
}
static struct bc_hw_ops hdlc_hw_ops = {
.read_fifo = hdlc_read_fifo,
static struct bc_l1_ops hdlc_l1_ops = {
.fill_fifo = hdlc_fill_fifo,
.open = setstack_hdlc,
.close = close_hdlcstate,
};
void __init
......@@ -524,10 +526,6 @@ inithdlc(struct IsdnCardState *cs)
debugl1(cs, "HDLC 2 VIN %x", val);
}
cs->bcs[0].BC_SetStack = setstack_hdlc;
cs->bcs[1].BC_SetStack = setstack_hdlc;
cs->bcs[0].BC_Close = close_hdlcstate;
cs->bcs[1].BC_Close = close_hdlcstate;
modehdlc(cs->bcs, -1, 0);
modehdlc(cs->bcs + 1, -1, 1);
}
......
......@@ -853,10 +853,11 @@ CallcFree(void)
static void
release_b_st(struct Channel *chanp)
{
struct IsdnCardState *cs = chanp->cs;
struct PStack *st = chanp->b_st;
if(test_and_clear_bit(FLG_START_B, &chanp->Flags)) {
chanp->bcs->BC_Close(chanp->bcs);
cs->bc_l1_ops->close(chanp->bcs);
switch (chanp->l2_active_protocol) {
case (ISDN_PROTO_L2_X75I):
releasestack_isdnl2(st);
......@@ -1297,7 +1298,7 @@ init_b_st(struct Channel *chanp, int incoming)
break;
}
chanp->bcs->conmsg = NULL;
if (chanp->bcs->BC_SetStack(st, chanp->bcs))
if (cs->bc_l1_ops->open(st, chanp->bcs))
return (-1);
st->l2.flag = 0;
test_and_set_bit(FLG_LAPB, &st->l2.flag);
......
......@@ -825,9 +825,9 @@ static void closecard(int cardnr)
{
struct IsdnCardState *csta = cards[cardnr].cs;
if (csta->bcs->BC_Close != NULL) {
csta->bcs->BC_Close(csta->bcs + 1);
csta->bcs->BC_Close(csta->bcs);
if (csta->bc_l1_ops->close) {
csta->bc_l1_ops->close(csta->bcs + 1);
csta->bc_l1_ops->close(csta->bcs);
}
skb_queue_purge(&csta->rq);
......@@ -1774,10 +1774,10 @@ int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[],
cs->iif.owner = hisax_d_if->owner; // FIXME should be done before registering
INIT_WORK(&cs->work, hisax_bh, cs);
cs->channel[0].d_st->l1.l2l1 = hisax_d_l2l1;
for (i = 0; i < 2; i++) {
cs->bcs[i].BC_SetStack = hisax_bc_setstack;
cs->bcs[i].BC_Close = hisax_bc_close;
cs->bc_l1_ops->open = hisax_bc_setstack;
cs->bc_l1_ops->close = hisax_bc_close;
for (i = 0; i < 2; i++) {
b_if[i]->ifc.l1l2 = hisax_b_l1l2;
hisax_d_if->b_if[i] = b_if[i];
......
......@@ -375,11 +375,6 @@ static inline void transmit_chars(struct IsdnCardState *cs, int *intr_done)
}
}
static struct bc_l1_ops modem_l1_ops = {
.fill_fifo = modem_fill,
};
static void rs_interrupt_elsa(int irq, struct IsdnCardState *cs)
{
int status, iir, msr;
......@@ -597,7 +592,7 @@ setstack_elsa(struct PStack *st, struct BCState *bcs)
if (open_hscxstate(st->l1.hardware, bcs))
return (-1);
st->l1.l2l1 = hscx_l2l1;
// bcs->cs->BC_Send_Data = hscx_fill_fifo;
// bcs->cs->BC_Send_Data = hscx_fill_fifo; FIXME
break;
case L1_MODE_MODEM:
bcs->mode = L1_MODE_MODEM;
......@@ -613,7 +608,7 @@ setstack_elsa(struct PStack *st, struct BCState *bcs)
bcs->tx_cnt = 0;
bcs->cs->hw.elsa.bcs = bcs;
st->l1.l2l1 = modem_l2l1;
bcs->cs->bc_l1_ops = &modem_l1_ops;
// bcs->cs->bc_l1_ops = &modem_l1_ops;
break;
}
st->l1.bcs = bcs;
......@@ -623,13 +618,17 @@ setstack_elsa(struct PStack *st, struct BCState *bcs)
return (0);
}
static struct bc_l1_ops modem_l1_ops = {
.fill_fifo = modem_fill,
.open = setstack_elsa,
.close = close_elsastate,
};
void
init_modem(struct IsdnCardState *cs) {
init_modem(struct IsdnCardState *cs)
{
cs->bc_l1_ops = &modem_l1_ops;
cs->bcs[0].BC_SetStack = setstack_elsa;
cs->bcs[1].BC_SetStack = setstack_elsa;
cs->bcs[0].BC_Close = close_elsastate;
cs->bcs[1].BC_Close = close_elsastate;
if (!(cs->hw.elsa.rcvbuf = kmalloc(MAX_MODEM_BUF,
GFP_ATOMIC))) {
printk(KERN_WARNING
......
......@@ -852,6 +852,8 @@ unsigned int __init
static struct bc_l1_ops hfcd_l1_ops = {
.fill_fifo = hfc_fill_fifo,
.open = setstack_2b,
.close = close_2bs0,
};
void __init
......@@ -870,10 +872,6 @@ init2bds0(struct IsdnCardState *cs)
if (!cs->bcs[1].hw.hfc.send)
cs->bcs[1].hw.hfc.send = init_send_hfcd(32);
cs->DC_Send_Data = hfc_fill_dfifo;
cs->bcs[0].BC_SetStack = setstack_2b;
cs->bcs[1].BC_SetStack = setstack_2b;
cs->bcs[0].BC_Close = close_2bs0;
cs->bcs[1].BC_Close = close_2bs0;
mode_2bs0(cs->bcs, 0, 0);
mode_2bs0(cs->bcs + 1, 0, 1);
}
......
......@@ -546,6 +546,8 @@ init_send(struct BCState *bcs)
static struct bc_l1_ops hfc_l1_ops = {
.fill_fifo = hfc_fill_fifo,
.open = setstack_hfc,
.close = close_hfcstate,
};
void __init
......@@ -554,10 +556,6 @@ inithfc(struct IsdnCardState *cs)
init_send(&cs->bcs[0]);
init_send(&cs->bcs[1]);
cs->bc_l1_ops = &hfc_l1_ops;
cs->bcs[0].BC_SetStack = setstack_hfc;
cs->bcs[1].BC_SetStack = setstack_hfc;
cs->bcs[0].BC_Close = close_hfcstate;
cs->bcs[1].BC_Close = close_hfcstate;
mode_hfc(cs->bcs, 0, 0);
mode_hfc(cs->bcs + 1, 0, 0);
}
......
......@@ -1337,6 +1337,8 @@ hfcpci_bh(void *data)
static struct bc_l1_ops hfcpci_l1_ops = {
.fill_fifo = hfcpci_fill_fifo,
.open = setstack_2b,
.close = close_hfcpci,
};
/********************************/
......@@ -1352,10 +1354,6 @@ inithfcpci(struct IsdnCardState *cs)
INIT_WORK(&cs->work, hfcpci_bh, cs);
cs->bc_l1_ops = &hfcpci_l1_ops;
cs->DC_Send_Data = hfcpci_fill_dfifo;
cs->bcs[0].BC_SetStack = setstack_2b;
cs->bcs[1].BC_SetStack = setstack_2b;
cs->bcs[0].BC_Close = close_hfcpci;
cs->bcs[1].BC_Close = close_hfcpci;
mode_hfcpci(cs->bcs, 0, 0);
mode_hfcpci(cs->bcs + 1, 0, 1);
}
......
......@@ -1114,6 +1114,8 @@ hfcsx_bh(void *data)
static struct bc_l1_ops hfcsx_l1_ops = {
.fill_fifo = hfcsx_fill_fifo,
.open = setstack_2b,
.close = close_hfcsx,
};
/********************************/
......@@ -1129,10 +1131,6 @@ inithfcsx(struct IsdnCardState *cs)
INIT_WORK(&cs->work, hfcsx_bh, cs);
cs->bc_l1_ops = &hfcsx_l1_ops;
cs->DC_Send_Data = hfcsx_fill_dfifo;
cs->bcs[0].BC_SetStack = setstack_2b;
cs->bcs[1].BC_SetStack = setstack_2b;
cs->bcs[0].BC_Close = close_hfcsx;
cs->bcs[1].BC_Close = close_hfcsx;
mode_hfcsx(cs->bcs, 0, 0);
mode_hfcsx(cs->bcs + 1, 0, 1);
}
......
......@@ -488,8 +488,6 @@ struct BCState {
struct timer_list transbusy;
struct work_struct work;
unsigned long event;
int (*BC_SetStack) (struct PStack *, struct BCState *);
void (*BC_Close) (struct BCState *);
#ifdef ERROR_STATISTIC
int err_crc;
int err_tx;
......@@ -878,6 +876,8 @@ struct dc_hw_ops {
struct bc_l1_ops {
void (*fill_fifo) (struct BCState *);
int (*open) (struct PStack *, struct BCState *);
void (*close) (struct BCState *);
};
#define HW_IOM1 0
......
......@@ -185,6 +185,8 @@ static void hscx_fill_fifo(struct BCState *bcs);
static struct bc_l1_ops hscx_l1_ops = {
.fill_fifo = hscx_fill_fifo,
.open = setstack_hscx,
.close = close_hscxstate,
};
void __init
......@@ -193,10 +195,6 @@ inithscx(struct IsdnCardState *cs)
int val, eval;
cs->bc_l1_ops = &hscx_l1_ops;
cs->bcs[0].BC_SetStack = setstack_hscx;
cs->bcs[1].BC_SetStack = setstack_hscx;
cs->bcs[0].BC_Close = close_hscxstate;
cs->bcs[1].BC_Close = close_hscxstate;
cs->bcs[0].unit = 0;
cs->bcs[1].unit = 1;
cs->bcs[0].hw.hscx.tsaxr0 = 0x2f;
......
......@@ -675,8 +675,6 @@ bch_setstack(struct PStack *st, struct BCState *bcs)
static void __devinit
bch_init(struct IsdnCardState *cs, int hscx)
{
cs->bcs[hscx].BC_SetStack = bch_setstack;
cs->bcs[hscx].BC_Close = bch_close_state;
cs->bcs[hscx].unit = hscx;
cs->bcs[hscx].cs = cs;
bch_mode(cs->bcs + hscx, 0, hscx);
......@@ -728,6 +726,8 @@ clear_pending_ints(struct IsdnCardState *cs)
static struct bc_l1_ops ipacx_bc_l1_ops = {
.fill_fifo = ipacx_bc_fill_fifo,
.open = bch_setstack,
.close = bch_close_state,
};
//----------------------------------------------------------
......
......@@ -1745,14 +1745,12 @@ isar_auxcmd(struct IsdnCardState *cs, isdn_ctrl *ic) {
static struct bc_l1_ops isar_l1_ops = {
.fill_fifo = isar_fill_fifo,
.open = setstack_isar,
.close = close_isarstate,
};
void __devinit
initisar(struct IsdnCardState *cs)
{
cs->bc_l1_ops = &isar_l1_ops;
cs->bcs[0].BC_SetStack = setstack_isar;
cs->bcs[1].BC_SetStack = setstack_isar;
cs->bcs[0].BC_Close = close_isarstate;
cs->bcs[1].BC_Close = close_isarstate;
}
......@@ -358,8 +358,6 @@ init_bcstate(struct IsdnCardState *cs,
bcs->cs = cs;
bcs->channel = bc;
INIT_WORK(&bcs->work, BChannel_bh, bcs);
bcs->BC_SetStack = NULL;
bcs->BC_Close = NULL;
bcs->Flag = 0;
}
......
......@@ -218,6 +218,8 @@ static void jade_fill_fifo(struct BCState *bcs);
static struct bc_l1_ops jade_l1_ops = {
.fill_fifo = jade_fill_fifo,
.open = setstack_jade,
.close = close_jadestate,
};
void __init
......@@ -226,10 +228,6 @@ initjade(struct IsdnCardState *cs)
int val;
cs->bc_l1_ops = &jade_l1_ops;
cs->bcs[0].BC_SetStack = setstack_jade;
cs->bcs[1].BC_SetStack = setstack_jade;
cs->bcs[0].BC_Close = close_jadestate;
cs->bcs[1].BC_Close = close_jadestate;
cs->bcs[0].unit = 0;
cs->bcs[1].unit = 1;
......
......@@ -937,6 +937,8 @@ setstack_tiger(struct PStack *st, struct BCState *bcs)
static struct bc_l1_ops netjet_l1_ops = {
.fill_fifo = netjet_fill_dma,
.open = setstack_tiger,
.close = close_tigerstate,
};
void __init
......@@ -994,10 +996,6 @@ inittiger(struct IsdnCardState *cs)
inl(cs->hw.njet.base + NETJET_DMA_READ_ADR),
bytein(cs->hw.njet.base + NETJET_PULSE_CNT));
cs->hw.njet.last_is0 = 0;
cs->bcs[0].BC_SetStack = setstack_tiger;
cs->bcs[1].BC_SetStack = setstack_tiger;
cs->bcs[0].BC_Close = close_tigerstate;
cs->bcs[1].BC_Close = close_tigerstate;
}
void
......
......@@ -658,10 +658,6 @@ void __init initW6692(struct IsdnCardState *cs, int part)
W6692_new_ph(cs);
ph_command(cs, W_L1CMD_ECK);
cs->bcs[0].BC_SetStack = setstack_w6692;
cs->bcs[1].BC_SetStack = setstack_w6692;
cs->bcs[0].BC_Close = close_w6692state;
cs->bcs[1].BC_Close = close_w6692state;
W6692Bmode(cs->bcs, 0, 0);
W6692Bmode(cs->bcs + 1, 0, 0);
}
......@@ -701,6 +697,8 @@ w6692_card_msg(struct IsdnCardState *cs, int mt, void *arg)
static struct bc_l1_ops w6692_bc_l1_ops = {
.fill_fifo = W6692B_fill_fifo,
.open = setstack_w6692,
.close = close_w6692state,
};
static int id_idx ;
......
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