Commit af71c8d4 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Fix the workqueue changes for the HiSax driver

Whoever did the tqueue -> workqueue changes didn't really care to look
at how it was used in the HiSax driver, making the driver compile but
oops with NULL pointer derefs.

Oh, and workqueues are really not the right solution here, tasklets are.
But that's for later.
parent 8f702872
......@@ -106,8 +106,9 @@ static const char *amd7930_revision = "$Revision: 1.5.6.4 $";
static void Bchan_fill_fifo(struct BCState *, struct sk_buff *);
static void
Bchan_xmt_bh(struct BCState *bcs)
Bchan_xmt_bh(void *data)
{
struct BCState *bcs = data;
struct sk_buff *skb;
if (bcs->hw.amd7930.tx_skb != NULL) {
......@@ -120,14 +121,14 @@ Bchan_xmt_bh(struct BCState *bcs)
} else {
clear_bit(BC_FLG_BUSY, &bcs->Flag);
bcs->event |= 1 << B_XMTBUFREADY;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
}
static void
Bchan_xmit_callback(struct BCState *bcs)
{
schedule_work(&bcs->hw.amd7930.tq_xmt);
schedule_work(&bcs->hw.amd7930.xmt_work);
}
/* B channel transmission: two modes (three, if you count L1_MODE_NULL)
......@@ -259,12 +260,13 @@ Bchan_recv_callback(struct BCState *bcs)
(void *) &Bchan_recv_callback, (void *) bcs);
}
schedule_work(&hw->tq_rcv);
schedule_work(&hw->rcv_work);
}
static void
Bchan_rcv_bh(struct BCState *bcs)
Bchan_rcv_bh(void *data)
{
struct BCState *bcs = data;
struct IsdnCardState *cs = bcs->cs;
struct amd7930_hw *hw = &bcs->hw.amd7930;
struct sk_buff *skb;
......@@ -305,7 +307,7 @@ Bchan_rcv_bh(struct BCState *bcs)
skb_queue_tail(&bcs->rqueue, hw->rv_skb);
hw->rv_skb = skb;
bcs->event |= 1 << B_RCVBUFREADY;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
} else if (len > 0) {
/* Small packet received */
......@@ -316,7 +318,7 @@ Bchan_rcv_bh(struct BCState *bcs)
memcpy(skb_put(skb, len), hw->rv_skb->tail, len);
skb_queue_tail(&bcs->rqueue, skb);
bcs->event |= 1 << B_RCVBUFREADY;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
} else {
/* Reception Error */
......@@ -332,7 +334,7 @@ Bchan_rcv_bh(struct BCState *bcs)
RCV_BUFSIZE/RCV_BUFBLKS);
skb_queue_tail(&bcs->rqueue, skb);
bcs->event |= 1 << B_RCVBUFREADY;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
}
......@@ -416,12 +418,8 @@ Bchan_init(struct BCState *bcs)
return;
}
bcs->hw.amd7930.tq_rcv.sync = 0;
INIT_WORK(&bcs->hw.amd7930.tq_rcv, (void (*)(void *)) &Bchan_rcv_bh,
(void *) bcs);
INIT_WORK(&bcs->hw.amd7930.tq_xmt, (void (*)(void *)) &Bchan_xmt_bh,
(void *) bcs);
INIT_WORK(&bcs->hw.amd7930.rcv_work, &Bchan_rcv_bh, bcs);
INIT_WORK(&bcs->hw.amd7930.xmt_work, &Bchan_xmt_bh, bcs);
}
static void
......
......@@ -232,9 +232,9 @@ Amd7930_new_ph(struct IsdnCardState *cs)
static void
Amd7930_bh(struct IsdnCardState *cs)
Amd7930_bh(void *data)
{
struct IsdnCardState *cs = data;
struct PStack *stptr;
if (!cs)
......@@ -277,7 +277,7 @@ Amd7930_sched_event(struct IsdnCardState *cs, int event) // ok
}
test_and_set_bit(event, &cs->event);
schedule_work(&cs->tqueue);
schedule_work(&cs->work);
}
static void
......@@ -790,7 +790,7 @@ Amd7930_init(struct IsdnCardState *cs)
cs->dc.amd7930.old_state = 0;
cs->dc.amd7930.lmr1 = 0x40;
cs->dc.amd7930.ph_command = Amd7930_ph_command;
INIT_WORK(&cs->tqueue, (void *) (void *) Amd7930_bh, NULL);
INIT_WORK(&cs->work, Amd7930_bh, cs);
cs->setstack_d = setstack_Amd7930;
cs->DC_Close = DC_Close_Amd7930;
cs->dbusytimer.function = (void *) dbusy_timer_handler;
......
......@@ -195,7 +195,7 @@ void inline
hdlc_sched_event(struct BCState *bcs, int event)
{
bcs->event |= 1 << event;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
void
......
......@@ -1160,7 +1160,6 @@ static int __devinit checkcard(int cardnr, char *id, int *busy_flag)
cs->tx_skb = NULL;
cs->tx_cnt = 0;
cs->event = 0;
cs->tqueue.data = cs;
skb_queue_head_init(&cs->rq);
skb_queue_head_init(&cs->sq);
......@@ -1738,7 +1737,7 @@ static void hisax_b_l2l1(struct PStack *st, int pr, void *arg);
static int hisax_cardmsg(struct IsdnCardState *cs, int mt, void *arg);
static int hisax_bc_setstack(struct PStack *st, struct BCState *bcs);
static void hisax_bc_close(struct BCState *bcs);
static void hisax_bh(struct IsdnCardState *cs);
static void hisax_bh(void *data);
static void EChannel_proc_rcv(struct hisax_d_if *d_if);
int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[],
......@@ -1770,7 +1769,7 @@ int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[],
hisax_d_if->cs = cs;
cs->hw.hisax_d_if = hisax_d_if;
cs->cardmsg = hisax_cardmsg;
INIT_WORK(&cs->tqueue, (void *) (void *) hisax_bh, NULL);
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;
......@@ -1799,11 +1798,12 @@ void hisax_unregister(struct hisax_d_if *hisax_d_if)
static void hisax_sched_event(struct IsdnCardState *cs, int event)
{
cs->event |= 1 << event;
schedule_work(&cs->tqueue);
schedule_work(&cs->work);
}
static void hisax_bh(struct IsdnCardState *cs)
static void hisax_bh(void *data)
{
struct IsdnCardState *cs = data;
struct PStack *st;
int pr;
......@@ -1825,7 +1825,7 @@ static void hisax_bh(struct IsdnCardState *cs)
static void hisax_b_sched_event(struct BCState *bcs, int event)
{
bcs->event |= 1 << event;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
static inline void D_L2L1(struct hisax_d_if *d_if, int pr, void *arg)
......
......@@ -146,7 +146,7 @@ static void change_speed(struct IsdnCardState *cs, int baud)
static int mstartup(struct IsdnCardState *cs)
{
unsigned unsigned long flags;
unsigned long flags;
int retval=0;
......
......@@ -202,7 +202,7 @@ static void
hfc_sched_event(struct BCState *bcs, int event)
{
bcs->event |= 1 << event;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
static struct sk_buff
......@@ -608,8 +608,9 @@ setstack_2b(struct PStack *st, struct BCState *bcs)
}
static void
hfcd_bh(struct IsdnCardState *cs)
hfcd_bh(void *data)
{
struct IsdnCardState *cs = data;
/* struct PStack *stptr;
*/
if (!cs)
......@@ -645,7 +646,7 @@ void
sched_event_D(struct IsdnCardState *cs, int event)
{
test_and_set_bit(event, &cs->event);
schedule_work(&cs->tqueue);
schedule_work(&cs->work);
}
static
......@@ -1127,7 +1128,7 @@ init2bds0(struct IsdnCardState *cs)
cs->dbusytimer.function = (void *) hfc_dbusy_timer;
cs->dbusytimer.data = (long) cs;
init_timer(&cs->dbusytimer);
INIT_WORK(&cs->tqueue, (void *) (void *) hfcd_bh, NULL);
INIT_WORK(&cs->work, hfcd_bh, cs);
if (!cs->hw.hfcD.send)
cs->hw.hfcD.send = init_send_hfcd(16);
if (!cs->bcs[0].hw.hfc.send)
......
......@@ -86,7 +86,7 @@ void
hfc_sched_event(struct BCState *bcs, int event)
{
bcs->event |= 1 << event;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
static void
......
......@@ -194,7 +194,7 @@ static void
sched_event_D_pci(struct IsdnCardState *cs, int event)
{
test_and_set_bit(event, &cs->event);
schedule_work(&cs->tqueue);
schedule_work(&cs->work);
}
/*********************************/
......@@ -204,7 +204,7 @@ static void
hfcpci_sched_event(struct BCState *bcs, int event)
{
bcs->event |= 1 << event;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
/************************************************/
......@@ -1535,8 +1535,9 @@ setstack_2b(struct PStack *st, struct BCState *bcs)
/* handle L1 state changes */
/***************************/
static void
hfcpci_bh(struct IsdnCardState *cs)
hfcpci_bh(void *data)
{
struct IsdnCardState *cs = data;
unsigned long flags;
/* struct PStack *stptr;
*/
......@@ -1622,7 +1623,7 @@ inithfcpci(struct IsdnCardState *cs)
cs->dbusytimer.function = (void *) hfcpci_dbusy_timer;
cs->dbusytimer.data = (long) cs;
init_timer(&cs->dbusytimer);
INIT_WORK(&cs->tqueue, (void *) (void *) hfcpci_bh, NULL);
INIT_WORK(&cs->work, hfcpci_bh, cs);
cs->BC_Send_Data = &hfcpci_send_data;
cs->bcs[0].BC_SetStack = setstack_2b;
cs->bcs[1].BC_SetStack = setstack_2b;
......
......@@ -464,7 +464,7 @@ static void
sched_event_D_sx(struct IsdnCardState *cs, int event)
{
test_and_set_bit(event, &cs->event);
schedule_work(&cs->tqueue);
schedule_work(&cs->work);
}
/*********************************/
......@@ -474,7 +474,7 @@ static void
hfcsx_sched_event(struct BCState *bcs, int event)
{
bcs->event |= 1 << event;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
/************************************************/
......@@ -1323,8 +1323,9 @@ setstack_2b(struct PStack *st, struct BCState *bcs)
/* handle L1 state changes */
/***************************/
static void
hfcsx_bh(struct IsdnCardState *cs)
hfcsx_bh(void *data)
{
struct IsdnCardState *cs = data;
unsigned long flags;
/* struct PStack *stptr;
*/
......@@ -1410,7 +1411,7 @@ inithfcsx(struct IsdnCardState *cs)
cs->dbusytimer.function = (void *) hfcsx_dbusy_timer;
cs->dbusytimer.data = (long) cs;
init_timer(&cs->dbusytimer);
INIT_WORK(&cs->tqueue, (void *) (void *) hfcsx_bh, NULL);
INIT_WORK(&cs->work, hfcsx_bh, cs);
cs->BC_Send_Data = &hfcsx_send_data;
cs->bcs[0].BC_SetStack = setstack_2b;
cs->bcs[1].BC_SetStack = setstack_2b;
......
......@@ -453,8 +453,8 @@ struct amd7930_hw {
int rv_buff_out;
struct sk_buff *rv_skb;
struct hdlc_state *hdlc_state;
struct work_struct tq_rcv;
struct work_struct tq_xmt;
struct work_struct rcv_work;
struct work_struct xmt_work;
};
#define BC_FLG_INIT 1
......@@ -495,7 +495,7 @@ struct BCState {
u_char *blog;
u_char *conmsg;
struct timer_list transbusy;
struct work_struct tqueue;
struct work_struct work;
unsigned long event;
int (*BC_SetStack) (struct PStack *, struct BCState *);
void (*BC_Close) (struct BCState *);
......@@ -954,7 +954,7 @@ struct IsdnCardState {
struct sk_buff *tx_skb;
int tx_cnt;
long event;
struct work_struct tqueue;
struct work_struct work;
struct timer_list dbusytimer;
#ifdef ERROR_STATISTIC
int err_crc;
......
......@@ -95,7 +95,7 @@ void
hscx_sched_event(struct BCState *bcs, int event)
{
bcs->event |= 1 << event;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
void
......
......@@ -78,8 +78,9 @@ icc_new_ph(struct IsdnCardState *cs)
}
static void
icc_bh(struct IsdnCardState *cs)
icc_bh(void *data)
{
struct IsdnCardState *cs = data;
struct PStack *stptr;
if (!cs)
......@@ -190,7 +191,7 @@ void
icc_sched_event(struct IsdnCardState *cs, int event)
{
test_and_set_bit(event, &cs->event);
schedule_work(&cs->tqueue);
schedule_work(&cs->work);
}
void
......@@ -622,7 +623,7 @@ dbusy_timer_handler(struct IsdnCardState *cs)
void __init
initicc(struct IsdnCardState *cs)
{
INIT_WORK(&cs->tqueue, (void *) (void *) icc_bh, NULL);
INIT_WORK(&cs->work, icc_bh, cs);
cs->setstack_d = setstack_icc;
cs->DC_Close = DC_Close_icc;
cs->dc.icc.mon_tx = NULL;
......
......@@ -38,7 +38,7 @@ static inline void cic_int(struct IsdnCardState *cs);
static void dch_l2l1(struct PStack *st, int pr, void *arg);
static void dbusy_timer_handler(struct IsdnCardState *cs);
static void ipacx_new_ph(struct IsdnCardState *cs);
static void dch_bh(struct IsdnCardState *cs);
static void dch_bh(void *data);
static void dch_sched_event(struct IsdnCardState *cs, int event);
static void dch_empty_fifo(struct IsdnCardState *cs, int count);
static void dch_fill_fifo(struct IsdnCardState *cs);
......@@ -272,8 +272,9 @@ ipacx_new_ph(struct IsdnCardState *cs)
// bottom half handler for D channel
//----------------------------------------------------------
static void
dch_bh(struct IsdnCardState *cs)
dch_bh(void *data)
{
struct IsdnCardState *cs = data;
struct PStack *st;
if (!cs) return;
......@@ -305,7 +306,7 @@ static void
dch_sched_event(struct IsdnCardState *cs, int event)
{
set_bit(event, &cs->event);
schedule_work(&cs->tqueue);
schedule_work(&cs->work);
}
//----------------------------------------------------------
......@@ -507,7 +508,7 @@ dch_init(struct IsdnCardState *cs)
{
printk(KERN_INFO "HiSax: IPACX ISDN driver v0.1.0\n");
INIT_WORK(&cs->tqueue, (void *)(void *) dch_bh, cs);
INIT_WORK(&cs->work, dch_bh, cs);
cs->setstack_d = dch_setstack;
cs->dbusytimer.function = (void *) dbusy_timer_handler;
......@@ -589,7 +590,7 @@ static void
bch_sched_event(struct BCState *bcs, int event)
{
bcs->event |= 1 << event;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
//----------------------------------------------------------
......
......@@ -82,8 +82,9 @@ isac_new_ph(struct IsdnCardState *cs)
}
static void
isac_bh(struct IsdnCardState *cs)
isac_bh(void *data)
{
struct IsdnCardState *cs = data;
struct PStack *stptr;
if (!cs)
......@@ -194,7 +195,7 @@ void
isac_sched_event(struct IsdnCardState *cs, int event)
{
test_and_set_bit(event, &cs->event);
schedule_work(&cs->tqueue);
schedule_work(&cs->work);
}
void
......@@ -624,7 +625,7 @@ dbusy_timer_handler(struct IsdnCardState *cs)
void __devinit
initisac(struct IsdnCardState *cs)
{
INIT_WORK(&cs->tqueue, (void *) (void *) isac_bh, NULL);
INIT_WORK(&cs->work, isac_bh, cs);
cs->setstack_d = setstack_isac;
cs->DC_Close = DC_Close_isac;
cs->dc.isac.mon_tx = NULL;
......
......@@ -429,8 +429,10 @@ extern void BChannel_bh(struct BCState *);
#define B_LL_OK 10
static void
isar_bh(struct BCState *bcs)
isar_bh(void *data)
{
struct BCState *bcs = data;
BChannel_bh(bcs);
if (test_and_clear_bit(B_LL_NOCARRIER, &bcs->event))
ll_deliver_faxstat(bcs, ISDN_FAX_CLASS1_NOCARR);
......@@ -444,7 +446,7 @@ static void
isar_sched_event(struct BCState *bcs, int event)
{
bcs->event |= 1 << event;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
static inline void
......@@ -1555,7 +1557,7 @@ isar_setup(struct IsdnCardState *cs)
cs->bcs[i].mode = 0;
cs->bcs[i].hw.isar.dpath = i + 1;
modeisar(&cs->bcs[i], 0, 0);
INIT_WORK(&cs->bcs[i].tqueue, (void *) (void *) isar_bh, NULL);
INIT_WORK(&cs->bcs[i].work, isar_bh, &cs->bcs[i]);
}
}
......
......@@ -299,10 +299,10 @@ BChannel_proc_rcv(struct BCState *bcs)
}
void
BChannel_bh(struct BCState *bcs)
BChannel_bh(void *data)
{
if (!bcs)
return;
struct BCState *bcs = data;
if (test_and_clear_bit(B_RCVBUFREADY, &bcs->event))
BChannel_proc_rcv(bcs);
if (test_and_clear_bit(B_XMTBUFREADY, &bcs->event))
......@@ -345,7 +345,7 @@ init_bcstate(struct IsdnCardState *cs,
bcs->cs = cs;
bcs->channel = bc;
INIT_WORK(&bcs->tqueue, (void *) (void *) BChannel_bh, bcs);
INIT_WORK(&bcs->work, BChannel_bh, bcs);
bcs->BC_SetStack = NULL;
bcs->BC_Close = NULL;
bcs->Flag = 0;
......
......@@ -138,7 +138,7 @@ void
jade_sched_event(struct BCState *bcs, int event)
{
bcs->event |= 1 << event;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
static void
......
......@@ -433,7 +433,7 @@ static void got_frame(struct BCState *bcs, int count) {
skb_queue_tail(&bcs->rqueue, skb);
}
bcs->event |= 1 << B_RCVBUFREADY;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
if (bcs->cs->debug & L1_DEB_RECEIVE_FRAME)
printframe(bcs->cs, bcs->hw.tiger.rcvbuf, count, "rec");
......@@ -789,7 +789,7 @@ static void write_raw(struct BCState *bcs, u_int *buf, int cnt) {
cnt - s_cnt);
}
bcs->event |= 1 << B_XMTBUFREADY;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
}
} else if (test_and_clear_bit(BC_FLG_NOFRAME, &bcs->Flag)) {
......
......@@ -104,8 +104,9 @@ W6692_new_ph(struct IsdnCardState *cs)
}
static void
W6692_bh(struct IsdnCardState *cs)
W6692_bh(void *data)
{
struct IsdnCardState *cs = data;
struct PStack *stptr;
if (!cs)
......@@ -137,14 +138,14 @@ void
W6692_sched_event(struct IsdnCardState *cs, int event)
{
test_and_set_bit(event, &cs->event);
schedule_work(&cs->tqueue);
schedule_work(&cs->work);
}
static void
W6692B_sched_event(struct BCState *bcs, int event)
{
bcs->event |= 1 << event;
schedule_work(&bcs->tqueue);
schedule_work(&bcs->work);
}
static void
......@@ -883,7 +884,7 @@ void resetW6692(struct IsdnCardState *cs)
void __init initW6692(struct IsdnCardState *cs, int part)
{
if (part & 1) {
INIT_WORK(&cs->tqueue, (void *) (void *) W6692_bh, NULL);
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;
......
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