@@ -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,8 +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
- int again ;
308
306
309
307
gig_dbg (DEBUG_OUTPUT , "modem_fill" );
310
308
@@ -313,36 +311,32 @@ static void gigaset_modem_fill(unsigned long data)
313
311
return ;
314
312
}
315
313
316
- do {
317
- again = 0 ;
318
- if (!bcs -> tx_skb ) { /* no skb is being sent */
319
- cb = cs -> cmdbuf ;
320
- if (cb ) { /* commands to send? */
321
- gig_dbg (DEBUG_OUTPUT , "modem_fill: cb" );
322
- if (send_cb (cs , cb ) < 0 ) {
323
- gig_dbg (DEBUG_OUTPUT ,
324
- "modem_fill: send_cb failed" );
325
- again = 1 ; /* no callback will be
326
- called! */
327
- }
328
- } else { /* skbs to send? */
329
- bcs -> tx_skb = skb_dequeue (& bcs -> squeue );
330
- if (bcs -> tx_skb )
331
- gig_dbg (DEBUG_INTR ,
332
- "Dequeued skb (Adr: %lx)!" ,
333
- (unsigned long ) bcs -> tx_skb );
334
- }
335
- }
336
-
337
- if (bcs -> tx_skb ) {
338
- gig_dbg (DEBUG_OUTPUT , "modem_fill: tx_skb" );
339
- if (write_modem (cs ) < 0 ) {
314
+ again :
315
+ if (!bcs -> tx_skb ) { /* no skb is being sent */
316
+ if (cs -> cmdbuf ) { /* commands to send? */
317
+ gig_dbg (DEBUG_OUTPUT , "modem_fill: cb" );
318
+ if (send_cb (cs ) < 0 ) {
340
319
gig_dbg (DEBUG_OUTPUT ,
341
- "modem_fill: write_modem failed" );
342
- again = 1 ; /* no callback will be called! */
320
+ "modem_fill: send_cb failed" );
321
+ goto again ; /* no callback will be called! */
343
322
}
323
+ return ;
344
324
}
345
- } while (again );
325
+
326
+ /* skbs to send? */
327
+ bcs -> tx_skb = skb_dequeue (& bcs -> squeue );
328
+ if (!bcs -> tx_skb )
329
+ return ;
330
+
331
+ gig_dbg (DEBUG_INTR , "Dequeued skb (Adr: %lx)!" ,
332
+ (unsigned long ) bcs -> tx_skb );
333
+ }
334
+
335
+ gig_dbg (DEBUG_OUTPUT , "modem_fill: tx_skb" );
336
+ if (write_modem (cs ) < 0 ) {
337
+ gig_dbg (DEBUG_OUTPUT , "modem_fill: write_modem failed" );
338
+ goto again ; /* no callback will be called! */
339
+ }
346
340
}
347
341
348
342
/*
@@ -429,36 +423,37 @@ static void gigaset_write_bulk_callback(struct urb *urb)
429
423
spin_unlock_irqrestore (& cs -> lock , flags );
430
424
}
431
425
432
- static int send_cb (struct cardstate * cs , struct cmdbuf_t * cb )
426
+ static int send_cb (struct cardstate * cs )
433
427
{
434
- struct cmdbuf_t * tcb ;
428
+ struct cmdbuf_t * cb = cs -> cmdbuf ;
435
429
unsigned long flags ;
436
430
int count ;
437
431
int status = - ENOENT ;
438
432
struct usb_cardstate * ucs = cs -> hw .usb ;
439
433
440
434
do {
441
435
if (!cb -> len ) {
442
- tcb = cb ;
443
-
444
436
spin_lock_irqsave (& cs -> cmdlock , flags );
445
437
cs -> cmdbytes -= cs -> curlen ;
446
438
gig_dbg (DEBUG_OUTPUT , "send_cb: sent %u bytes, %u left" ,
447
439
cs -> curlen , cs -> cmdbytes );
448
- cs -> cmdbuf = cb = cb -> next ;
449
- if (cb ) {
450
- cb -> prev = NULL ;
451
- cs -> curlen = cb -> len ;
440
+ cs -> cmdbuf = cb -> next ;
441
+ if (cs -> cmdbuf ) {
442
+ cs -> cmdbuf -> prev = NULL ;
443
+ cs -> curlen = cs -> cmdbuf -> len ;
452
444
} else {
453
445
cs -> lastcmdbuf = NULL ;
454
446
cs -> curlen = 0 ;
455
447
}
456
448
spin_unlock_irqrestore (& cs -> cmdlock , flags );
457
449
458
- if (tcb -> wake_tasklet )
459
- tasklet_schedule (tcb -> wake_tasklet );
460
- kfree (tcb );
450
+ if (cb -> wake_tasklet )
451
+ tasklet_schedule (cb -> wake_tasklet );
452
+ kfree (cb );
453
+
454
+ cb = cs -> cmdbuf ;
461
455
}
456
+
462
457
if (cb ) {
463
458
count = min (cb -> len , ucs -> bulk_out_size );
464
459
gig_dbg (DEBUG_OUTPUT , "send_cb: send %d bytes" , count );
0 commit comments