Skip to content

Commit f650dd2

Browse files
tilmanschmidtdavem330
authored andcommitted
isdn/gigaset: clarify gigaset_modem_fill control structure
Replace the flag-controlled retry loop by explicit goto statements in the error branches to make the control structure easier to understand. Signed-off-by: Tilman Schmidt <tilman@imap.cc> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ff66fc3 commit f650dd2

File tree

1 file changed

+24
-28
lines changed

1 file changed

+24
-28
lines changed

drivers/isdn/gigaset/usb-gigaset.c

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ static void gigaset_modem_fill(unsigned long data)
304304
struct cardstate *cs = (struct cardstate *) data;
305305
struct bc_state *bcs = &cs->bcs[0]; /* only one channel */
306306
struct cmdbuf_t *cb;
307-
int again;
308307

309308
gig_dbg(DEBUG_OUTPUT, "modem_fill");
310309

@@ -313,36 +312,33 @@ static void gigaset_modem_fill(unsigned long data)
313312
return;
314313
}
315314

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) {
315+
again:
316+
if (!bcs->tx_skb) { /* no skb is being sent */
317+
cb = cs->cmdbuf;
318+
if (cb) { /* commands to send? */
319+
gig_dbg(DEBUG_OUTPUT, "modem_fill: cb");
320+
if (send_cb(cs, cb) < 0) {
340321
gig_dbg(DEBUG_OUTPUT,
341-
"modem_fill: write_modem failed");
342-
again = 1; /* no callback will be called! */
322+
"modem_fill: send_cb failed");
323+
goto again; /* no callback will be called! */
343324
}
325+
return;
344326
}
345-
} while (again);
327+
328+
/* skbs to send? */
329+
bcs->tx_skb = skb_dequeue(&bcs->squeue);
330+
if (!bcs->tx_skb)
331+
return;
332+
333+
gig_dbg(DEBUG_INTR, "Dequeued skb (Adr: %lx)!",
334+
(unsigned long) bcs->tx_skb);
335+
}
336+
337+
gig_dbg(DEBUG_OUTPUT, "modem_fill: tx_skb");
338+
if (write_modem(cs) < 0) {
339+
gig_dbg(DEBUG_OUTPUT, "modem_fill: write_modem failed");
340+
goto again; /* no callback will be called! */
341+
}
346342
}
347343

348344
/*

0 commit comments

Comments
 (0)