Skip to content

Commit f99a6fd

Browse files
tilmanschmidtdavem330
authored andcommitted
isdn/gigaset: elliminate unnecessary argument from send_cb()
No need to pass a member of the cardstate structure as a separate argument if the entire structure is already passed. Signed-off-by: Tilman Schmidt <tilman@imap.cc> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f650dd2 commit f99a6fd

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

drivers/isdn/gigaset/usb-gigaset.c

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static int gigaset_close_bchannel(struct bc_state *bcs)
293293
}
294294

295295
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);
297297

298298

299299
/* Write tasklet handler: Continue sending current skb, or send command, or
@@ -303,7 +303,6 @@ static void gigaset_modem_fill(unsigned long data)
303303
{
304304
struct cardstate *cs = (struct cardstate *) data;
305305
struct bc_state *bcs = &cs->bcs[0]; /* only one channel */
306-
struct cmdbuf_t *cb;
307306

308307
gig_dbg(DEBUG_OUTPUT, "modem_fill");
309308

@@ -314,10 +313,9 @@ static void gigaset_modem_fill(unsigned long data)
314313

315314
again:
316315
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? */
319317
gig_dbg(DEBUG_OUTPUT, "modem_fill: cb");
320-
if (send_cb(cs, cb) < 0) {
318+
if (send_cb(cs) < 0) {
321319
gig_dbg(DEBUG_OUTPUT,
322320
"modem_fill: send_cb failed");
323321
goto again; /* no callback will be called! */
@@ -425,36 +423,37 @@ static void gigaset_write_bulk_callback(struct urb *urb)
425423
spin_unlock_irqrestore(&cs->lock, flags);
426424
}
427425

428-
static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb)
426+
static int send_cb(struct cardstate *cs)
429427
{
430-
struct cmdbuf_t *tcb;
428+
struct cmdbuf_t *cb = cs->cmdbuf;
431429
unsigned long flags;
432430
int count;
433431
int status = -ENOENT;
434432
struct usb_cardstate *ucs = cs->hw.usb;
435433

436434
do {
437435
if (!cb->len) {
438-
tcb = cb;
439-
440436
spin_lock_irqsave(&cs->cmdlock, flags);
441437
cs->cmdbytes -= cs->curlen;
442438
gig_dbg(DEBUG_OUTPUT, "send_cb: sent %u bytes, %u left",
443439
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;
448444
} else {
449445
cs->lastcmdbuf = NULL;
450446
cs->curlen = 0;
451447
}
452448
spin_unlock_irqrestore(&cs->cmdlock, flags);
453449

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;
457455
}
456+
458457
if (cb) {
459458
count = min(cb->len, ucs->bulk_out_size);
460459
gig_dbg(DEBUG_OUTPUT, "send_cb: send %d bytes", count);

0 commit comments

Comments
 (0)