@@ -293,7 +293,7 @@ static int gigaset_close_bchannel(struct bc_state *bcs)
293
293
}
294
294
295
295
static int write_modem (struct cardstate * cs );
296
- static int send_cb (struct cardstate * cs , struct cmdbuf_t * cb );
296
+ static int send_cb (struct cardstate * cs );
297
297
298
298
299
299
/* Write tasklet handler: Continue sending current skb, or send command, or
@@ -303,7 +303,6 @@ static void gigaset_modem_fill(unsigned long data)
303
303
{
304
304
struct cardstate * cs = (struct cardstate * ) data ;
305
305
struct bc_state * bcs = & cs -> bcs [0 ]; /* only one channel */
306
- struct cmdbuf_t * cb ;
307
306
308
307
gig_dbg (DEBUG_OUTPUT , "modem_fill" );
309
308
@@ -314,10 +313,9 @@ static void gigaset_modem_fill(unsigned long data)
314
313
315
314
again :
316
315
if (!bcs -> tx_skb ) { /* no skb is being sent */
317
- cb = cs -> cmdbuf ;
318
- if (cb ) { /* commands to send? */
316
+ if (cs -> cmdbuf ) { /* commands to send? */
319
317
gig_dbg (DEBUG_OUTPUT , "modem_fill: cb" );
320
- if (send_cb (cs , cb ) < 0 ) {
318
+ if (send_cb (cs ) < 0 ) {
321
319
gig_dbg (DEBUG_OUTPUT ,
322
320
"modem_fill: send_cb failed" );
323
321
goto again ; /* no callback will be called! */
@@ -425,36 +423,37 @@ static void gigaset_write_bulk_callback(struct urb *urb)
425
423
spin_unlock_irqrestore (& cs -> lock , flags );
426
424
}
427
425
428
- static int send_cb (struct cardstate * cs , struct cmdbuf_t * cb )
426
+ static int send_cb (struct cardstate * cs )
429
427
{
430
- struct cmdbuf_t * tcb ;
428
+ struct cmdbuf_t * cb = cs -> cmdbuf ;
431
429
unsigned long flags ;
432
430
int count ;
433
431
int status = - ENOENT ;
434
432
struct usb_cardstate * ucs = cs -> hw .usb ;
435
433
436
434
do {
437
435
if (!cb -> len ) {
438
- tcb = cb ;
439
-
440
436
spin_lock_irqsave (& cs -> cmdlock , flags );
441
437
cs -> cmdbytes -= cs -> curlen ;
442
438
gig_dbg (DEBUG_OUTPUT , "send_cb: sent %u bytes, %u left" ,
443
439
cs -> curlen , cs -> cmdbytes );
444
- cs -> cmdbuf = cb = cb -> next ;
445
- if (cb ) {
446
- cb -> prev = NULL ;
447
- cs -> curlen = cb -> len ;
440
+ cs -> cmdbuf = cb -> next ;
441
+ if (cs -> cmdbuf ) {
442
+ cs -> cmdbuf -> prev = NULL ;
443
+ cs -> curlen = cs -> cmdbuf -> len ;
448
444
} else {
449
445
cs -> lastcmdbuf = NULL ;
450
446
cs -> curlen = 0 ;
451
447
}
452
448
spin_unlock_irqrestore (& cs -> cmdlock , flags );
453
449
454
- if (tcb -> wake_tasklet )
455
- tasklet_schedule (tcb -> wake_tasklet );
456
- kfree (tcb );
450
+ if (cb -> wake_tasklet )
451
+ tasklet_schedule (cb -> wake_tasklet );
452
+ kfree (cb );
453
+
454
+ cb = cs -> cmdbuf ;
457
455
}
456
+
458
457
if (cb ) {
459
458
count = min (cb -> len , ucs -> bulk_out_size );
460
459
gig_dbg (DEBUG_OUTPUT , "send_cb: send %d bytes" , count );
0 commit comments