Commit ad7f8a9b authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/HiSax: Move open/close of D-channel stack -> dc_l1_ops

Same change which happened for the B-channel earlier.
parent 6cc9cb58
......@@ -659,7 +659,7 @@ Amd7930_l1hw(struct PStack *st, int pr, void *arg)
}
}
void
static int
setstack_Amd7930(struct PStack *st, struct IsdnCardState *cs)
{
......@@ -667,16 +667,9 @@ setstack_Amd7930(struct PStack *st, struct IsdnCardState *cs)
debugl1(cs, "Amd7930: setstack called");
st->l1.l1hw = Amd7930_l1hw;
return 0;
}
void
DC_Close_Amd7930(struct IsdnCardState *cs) {
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "Amd7930: DC_Close called");
}
static void
dbusy_timer_handler(struct IsdnCardState *cs)
{
......@@ -764,6 +757,9 @@ static u16 initAMD[] = {
0xFFFF};
static struct dc_l1_ops amd7930_l1_ops = {
.open = setstack_Amd7930,
};
void __devinit
Amd7930_init(struct IsdnCardState *cs)
......@@ -779,8 +775,7 @@ Amd7930_init(struct IsdnCardState *cs)
cs->dc.amd7930.lmr1 = 0x40;
cs->dc.amd7930.ph_command = Amd7930_ph_command;
INIT_WORK(&cs->work, Amd7930_bh, cs);
cs->setstack_d = setstack_Amd7930;
cs->DC_Close = DC_Close_Amd7930;
cs->dc_l1_ops = &amd7930_l1_ops;
cs->dbusytimer.function = (void *) dbusy_timer_handler;
cs->dbusytimer.data = (long) cs;
init_timer(&cs->dbusytimer);
......
......@@ -840,9 +840,9 @@ static void closecard(int cardnr)
dev_kfree_skb(csta->tx_skb);
csta->tx_skb = NULL;
}
if (csta->DC_Close != NULL) {
csta->DC_Close(csta);
}
if (csta->dc_l1_ops->close)
csta->dc_l1_ops->close(csta);
if (csta->card_ops->release)
csta->card_ops->release(csta);
if (csta->dbusytimer.function != NULL) // FIXME?
......
......@@ -824,10 +824,11 @@ HFCD_l1hw(struct PStack *st, int pr, void *arg)
}
}
void
static int
setstack_hfcd(struct PStack *st, struct IsdnCardState *cs)
{
st->l1.l1hw = HFCD_l1hw;
return 0;
}
static void
......@@ -850,17 +851,23 @@ unsigned int __init
return(send);
}
static struct bc_l1_ops hfcd_l1_ops = {
static struct bc_l1_ops hfcd_bc_l1_ops = {
.fill_fifo = hfc_fill_fifo,
.open = setstack_2b,
.close = close_2bs0,
};
static struct dc_l1_ops hfcd_dc_l1_ops = {
.fill_fifo = hfc_fill_dfifo,
.open = setstack_hfcd,
};
void __init
init2bds0(struct IsdnCardState *cs)
{
cs->bc_l1_ops = &hfcd_l1_ops;
cs->setstack_d = setstack_hfcd;
cs->bc_l1_ops = &hfcd_bc_l1_ops;
cs->dc_l1_ops = &hfcd_dc_l1_ops;
cs->dbusytimer.function = (void *) hfc_dbusy_timer;
cs->dbusytimer.data = (long) cs;
init_timer(&cs->dbusytimer);
......@@ -871,7 +878,6 @@ init2bds0(struct IsdnCardState *cs)
cs->bcs[0].hw.hfc.send = init_send_hfcd(32);
if (!cs->bcs[1].hw.hfc.send)
cs->bcs[1].hw.hfc.send = init_send_hfcd(32);
cs->DC_Send_Data = hfc_fill_dfifo;
mode_2bs0(cs->bcs, 0, 0);
mode_2bs0(cs->bcs + 1, 0, 1);
}
......
......@@ -1049,10 +1049,11 @@ HFCPCI_l1hw(struct PStack *st, int pr, void *arg)
/***********************************************/
/* called during init setting l1 stack pointer */
/***********************************************/
void
static int
setstack_hfcpci(struct PStack *st, struct IsdnCardState *cs)
{
st->l1.l1hw = HFCPCI_l1hw;
return 0;
}
/***************************************************************/
......@@ -1337,25 +1338,29 @@ hfcpci_bh(void *data)
DChannel_proc_xmt(cs);
}
static struct bc_l1_ops hfcpci_l1_ops = {
static struct bc_l1_ops hfcpci_bc_l1_ops = {
.fill_fifo = hfcpci_fill_fifo,
.open = setstack_2b,
.close = close_hfcpci,
};
static struct dc_l1_ops hfcpci_dc_l1_ops = {
.fill_fifo = hfcpci_fill_dfifo,
.open = setstack_hfcpci,
};
/********************************/
/* called for card init message */
/********************************/
void __init
inithfcpci(struct IsdnCardState *cs)
{
cs->setstack_d = setstack_hfcpci;
cs->dbusytimer.function = (void *) hfcpci_dbusy_timer;
cs->dbusytimer.data = (long) cs;
init_timer(&cs->dbusytimer);
INIT_WORK(&cs->work, hfcpci_bh, cs);
cs->bc_l1_ops = &hfcpci_l1_ops;
cs->DC_Send_Data = hfcpci_fill_dfifo;
cs->bc_l1_ops = &hfcpci_bc_l1_ops;
cs->dc_l1_ops = &hfcpci_dc_l1_ops;
mode_hfcpci(cs->bcs, 0, 0);
mode_hfcpci(cs->bcs + 1, 0, 1);
}
......
......@@ -839,10 +839,11 @@ HFCSX_l1hw(struct PStack *st, int pr, void *arg)
/***********************************************/
/* called during init setting l1 stack pointer */
/***********************************************/
void
static int
setstack_hfcsx(struct PStack *st, struct IsdnCardState *cs)
{
st->l1.l1hw = HFCSX_l1hw;
return 0;
}
/***************************************************************/
......@@ -1113,25 +1114,29 @@ hfcsx_bh(void *data)
DChannel_proc_xmt(cs);
}
static struct bc_l1_ops hfcsx_l1_ops = {
static struct bc_l1_ops hfcsx_bc_l1_ops = {
.fill_fifo = hfcsx_fill_fifo,
.open = setstack_2b,
.close = close_hfcsx,
};
static struct dc_l1_ops hfcsx_dc_l1_ops = {
.fill_fifo = hfcsx_fill_dfifo,
.open = setstack_hfcsx,
};
/********************************/
/* called for card init message */
/********************************/
void __devinit
inithfcsx(struct IsdnCardState *cs)
{
cs->setstack_d = setstack_hfcsx;
cs->dbusytimer.function = (void *) hfcsx_dbusy_timer;
cs->dbusytimer.data = (long) cs;
init_timer(&cs->dbusytimer);
INIT_WORK(&cs->work, hfcsx_bh, cs);
cs->bc_l1_ops = &hfcsx_l1_ops;
cs->DC_Send_Data = hfcsx_fill_dfifo;
cs->bc_l1_ops = &hfcsx_bc_l1_ops;
cs->dc_l1_ops = &hfcsx_dc_l1_ops;
mode_hfcsx(cs->bcs, 0, 0);
mode_hfcsx(cs->bcs + 1, 0, 1);
}
......
......@@ -878,7 +878,7 @@ struct dc_hw_ops {
void (*write_fifo) (struct IsdnCardState *, u8 *, int);
};
/* Methods provided to shared FIFO handling */
/* Methods provided to shared B-channel FIFO handling */
struct bc_l1_ops {
void (*fill_fifo) (struct BCState *);
......@@ -886,6 +886,14 @@ struct bc_l1_ops {
void (*close) (struct BCState *);
};
/* Methods provided to shared D-channel FIFO handling */
struct dc_l1_ops {
void (*fill_fifo) (struct IsdnCardState *);
int (*open) (struct PStack *, struct IsdnCardState *);
void (*close) (struct IsdnCardState *);
};
#define HW_IOM1 0
#define HW_IPAC 1
#define HW_ISAR 2
......@@ -945,11 +953,9 @@ struct IsdnCardState {
u8 *status_end;
struct dc_hw_ops *dc_hw_ops;
struct bc_hw_ops *bc_hw_ops;
struct dc_l1_ops *dc_l1_ops;
struct bc_l1_ops *bc_l1_ops;
int (*cardmsg) (struct IsdnCardState *, int, void *);
void (*setstack_d) (struct PStack *, struct IsdnCardState *);
void (*DC_Send_Data) (struct IsdnCardState *);
void (*DC_Close) (struct IsdnCardState *);
int (*auxcmd) (struct IsdnCardState *, isdn_ctrl *);
struct Channel channel[2+MAX_WAITING_CALLS];
struct BCState bcs[2+MAX_WAITING_CALLS];
......@@ -1365,9 +1371,6 @@ int QuickHex(char *txt, u8 * p, int cnt);
void LogFrame(struct IsdnCardState *cs, u8 * p, int size);
void dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir);
void iecpy(u8 * dest, u8 * iestart, int ieoffset);
#ifdef ISDN_CHIP_ISAC
void setstack_isac(struct PStack *st, struct IsdnCardState *cs);
#endif /* ISDN_CHIP_ISAC */
#endif /* __KERNEL__ */
#define HZDELAY(jiffs) {int tout = jiffs; while (tout--) udelay(1000000/HZ);}
......
......@@ -443,10 +443,11 @@ ICC_l1hw(struct PStack *st, int pr, void *arg)
}
}
void
static int
setstack_icc(struct PStack *st, struct IsdnCardState *cs)
{
st->l1.l1hw = ICC_l1hw;
return 0;
}
void
......@@ -497,15 +498,19 @@ dbusy_timer_handler(struct IsdnCardState *cs)
}
}
static struct dc_l1_ops icc_l1_ops = {
.fill_fifo = icc_fill_fifo,
.open = setstack_icc,
.close = DC_Close_icc,
};
void __init
initicc(struct IsdnCardState *cs)
{
int val, eval;
cs->dc_l1_ops = &icc_l1_ops;
INIT_WORK(&cs->work, icc_bh, cs);
cs->setstack_d = setstack_icc;
cs->DC_Send_Data = icc_fill_fifo;
cs->DC_Close = DC_Close_icc;
cs->dc.icc.mon_tx = NULL;
cs->dc.icc.mon_rx = NULL;
cs->dbusytimer.function = (void *) dbusy_timer_handler;
......
......@@ -41,8 +41,6 @@ static void dch_bh(void *data);
static void dch_empty_fifo(struct IsdnCardState *cs, int count);
static void dch_fill_fifo(struct IsdnCardState *cs);
static inline void dch_int(struct IsdnCardState *cs);
static void __devinit dch_setstack(struct PStack *st, struct IsdnCardState *cs);
static void __devinit dch_init(struct IsdnCardState *cs);
static void bch_l2l1(struct PStack *st, int pr, void *arg);
static void ipacx_bc_empty_fifo(struct BCState *bcs, int count);
static void bch_int(struct IsdnCardState *cs, u8 hscx);
......@@ -396,12 +394,18 @@ dch_int(struct IsdnCardState *cs)
//----------------------------------------------------------
//----------------------------------------------------------
static void __devinit
static int
dch_setstack(struct PStack *st, struct IsdnCardState *cs)
{
st->l1.l1hw = dch_l2l1;
return 0;
}
static struct dc_l1_ops ipacx_dc_l1_ops = {
.fill_fifo = dch_fill_fifo,
.open = dch_setstack,
};
//----------------------------------------------------------
//----------------------------------------------------------
static void __devinit
......@@ -409,9 +413,8 @@ dch_init(struct IsdnCardState *cs)
{
printk(KERN_INFO "HiSax: IPACX ISDN driver v0.1.0\n");
cs->dc_l1_ops = &ipacx_dc_l1_ops;
INIT_WORK(&cs->work, dch_bh, cs);
cs->setstack_d = dch_setstack;
cs->DC_Send_Data = dch_fill_fifo;
cs->dbusytimer.function = (void *) dbusy_timer_handler;
cs->dbusytimer.data = (long) cs;
init_timer(&cs->dbusytimer);
......
......@@ -441,13 +441,14 @@ ISAC_l1hw(struct PStack *st, int pr, void *arg)
}
}
void
static int
setstack_isac(struct PStack *st, struct IsdnCardState *cs)
{
st->l1.l1hw = ISAC_l1hw;
return 0;
}
void
static void
DC_Close_isac(struct IsdnCardState *cs) {
if (cs->dc.isac.mon_rx) {
kfree(cs->dc.isac.mon_rx);
......@@ -495,6 +496,12 @@ dbusy_timer_handler(struct IsdnCardState *cs)
}
}
static struct dc_l1_ops isac_l1_ops = {
.fill_fifo = isac_fill_fifo,
.open = setstack_isac,
.close = DC_Close_isac,
};
void __devinit
initisac(struct IsdnCardState *cs)
{
......@@ -515,10 +522,8 @@ initisac(struct IsdnCardState *cs)
/* Disable all IRQ */
isac_write(cs, ISAC_MASK, 0xFF);
cs->dc_l1_ops = &isac_l1_ops;
INIT_WORK(&cs->work, isac_bh, cs);
cs->setstack_d = setstack_isac;
cs->DC_Send_Data = isac_fill_fifo;
cs->DC_Close = DC_Close_isac;
cs->dc.isac.mon_tx = NULL;
cs->dc.isac.mon_rx = NULL;
cs->dbusytimer.function = (void *) dbusy_timer_handler;
......
......@@ -905,8 +905,8 @@ setstack_HiSax(struct PStack *st, struct IsdnCardState *cs)
setstack_manager(st);
st->l1.stlistp = &(cs->stlist);
st->l1.l2l1 = dch_l2l1;
if (cs->setstack_d)
cs->setstack_d(st, cs);
if (cs->dc_l1_ops->open)
cs->dc_l1_ops->open(st, cs);
}
void
......
......@@ -37,6 +37,12 @@ fill_fifo_b(struct BCState *bcs)
bcs->cs->bc_l1_ops->fill_fifo(bcs);
}
static inline void
fill_fifo_d(struct IsdnCardState *cs)
{
cs->dc_l1_ops->fill_fifo(cs);
}
#ifdef L2FRAME_DEBUG
extern void Logl2Frame(struct IsdnCardState *cs, struct sk_buff *skb, char *buf, int dir);
#endif
......@@ -94,7 +100,7 @@ xmit_ready_d(struct IsdnCardState *cs)
cs->tx_skb = skb_dequeue(&cs->sq);
if (cs->tx_skb) {
cs->tx_cnt = 0;
cs->DC_Send_Data(cs);
fill_fifo_d(cs);
} else {
sched_d_event(cs, D_XMTBUFREADY);
}
......@@ -141,7 +147,7 @@ xmit_data_req_d(struct IsdnCardState *cs, struct sk_buff *skb)
if (cs->debug & L1_DEB_LAPD)
Logl2Frame(cs, skb, "PH_DATA", 0);
#endif
cs->DC_Send_Data(cs);
fill_fifo_d(cs);
}
spin_unlock_irqrestore(&cs->lock, flags);
}
......@@ -183,7 +189,7 @@ xmit_pull_ind_d(struct IsdnCardState *cs, struct sk_buff *skb)
#endif
cs->tx_skb = skb;
cs->tx_cnt = 0;
cs->DC_Send_Data(cs);
fill_fifo_d(cs);
}
spin_unlock_irqrestore(&cs->lock, flags);
}
......@@ -296,7 +302,7 @@ xmit_xpr_d(struct IsdnCardState *cs)
if (cs->tx_skb) {
/* last frame not done yet? */
if (cs->tx_skb->len) {
cs->DC_Send_Data(cs);
fill_fifo_d(cs);
return;
}
xmit_complete_d(cs);
......
......@@ -456,15 +456,11 @@ W6692_l1hw(struct PStack *st, int pr, void *arg)
}
}
static void
static int
setstack_W6692(struct PStack *st, struct IsdnCardState *cs)
{
st->l1.l1hw = W6692_l1hw;
}
static void
DC_Close_W6692(struct IsdnCardState *cs)
{
return 0;
}
static void
......@@ -621,8 +617,6 @@ static void
w6692_init(struct IsdnCardState *cs)
{
INIT_WORK(&cs->work, W6692_bh, cs);
cs->setstack_d = setstack_W6692;
cs->DC_Close = DC_Close_W6692;
cs->dbusytimer.function = (void *) dbusy_timer_handler;
cs->dbusytimer.data = (long) cs;
init_timer(&cs->dbusytimer);
......@@ -667,6 +661,11 @@ static struct card_ops w6692_ops = {
.irq_func = w6692_interrupt,
};
static struct dc_l1_ops w6692_dc_l1_ops = {
.fill_fifo = W6692_fill_fifo,
.open = setstack_W6692,
};
static struct bc_l1_ops w6692_bc_l1_ops = {
.fill_fifo = W6692B_fill_fifo,
.open = setstack_w6692,
......@@ -763,8 +762,8 @@ setup_w6692(struct IsdnCard *card)
cs->dc_hw_ops = &w6692_dc_hw_ops;
cs->bc_hw_ops = &w6692_bc_hw_ops;
cs->dc_l1_ops = &w6692_dc_l1_ops;
cs->bc_l1_ops = &w6692_bc_l1_ops;
cs->DC_Send_Data = &W6692_fill_fifo;
cs->cardmsg = &w6692_card_msg;
cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &w6692_ops;
......
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