diff options
author | Tilman Schmidt <tilman@imap.cc> | 2014-12-10 07:41:55 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-12-10 15:06:09 -0500 |
commit | f650dd28051f5dc66986407f7b2d50e5828642cb (patch) | |
tree | 7729bbc0c6f704fdd085962c5c86fe4a7a32213f | |
parent | ff66fc3ab0a4bd28abbc9e3caee159be1d195676 (diff) |
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>
-rw-r--r-- | drivers/isdn/gigaset/usb-gigaset.c | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c index a8e652dac54d..c31d74626498 100644 --- a/drivers/isdn/gigaset/usb-gigaset.c +++ b/drivers/isdn/gigaset/usb-gigaset.c | |||
@@ -304,7 +304,6 @@ static void gigaset_modem_fill(unsigned long data) | |||
304 | struct cardstate *cs = (struct cardstate *) data; | 304 | struct cardstate *cs = (struct cardstate *) data; |
305 | struct bc_state *bcs = &cs->bcs[0]; /* only one channel */ | 305 | struct bc_state *bcs = &cs->bcs[0]; /* only one channel */ |
306 | struct cmdbuf_t *cb; | 306 | struct cmdbuf_t *cb; |
307 | int again; | ||
308 | 307 | ||
309 | gig_dbg(DEBUG_OUTPUT, "modem_fill"); | 308 | gig_dbg(DEBUG_OUTPUT, "modem_fill"); |
310 | 309 | ||
@@ -313,36 +312,33 @@ static void gigaset_modem_fill(unsigned long data) | |||
313 | return; | 312 | return; |
314 | } | 313 | } |
315 | 314 | ||
316 | do { | 315 | again: |
317 | again = 0; | 316 | if (!bcs->tx_skb) { /* no skb is being sent */ |
318 | if (!bcs->tx_skb) { /* no skb is being sent */ | 317 | cb = cs->cmdbuf; |
319 | cb = cs->cmdbuf; | 318 | if (cb) { /* commands to send? */ |
320 | if (cb) { /* commands to send? */ | 319 | gig_dbg(DEBUG_OUTPUT, "modem_fill: cb"); |
321 | gig_dbg(DEBUG_OUTPUT, "modem_fill: cb"); | 320 | if (send_cb(cs, cb) < 0) { |
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) { | ||
340 | gig_dbg(DEBUG_OUTPUT, | 321 | gig_dbg(DEBUG_OUTPUT, |
341 | "modem_fill: write_modem failed"); | 322 | "modem_fill: send_cb failed"); |
342 | again = 1; /* no callback will be called! */ | 323 | goto again; /* no callback will be called! */ |
343 | } | 324 | } |
325 | return; | ||
344 | } | 326 | } |
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 | } | ||
346 | } | 342 | } |
347 | 343 | ||
348 | /* | 344 | /* |