Skip to content

Commit b03efcf

Browse files
committed
[NET]: Transform skb_queue_len() binary tests into skb_queue_empty()
This is part of the grand scheme to eliminate the qlen member of skb_queue_head, and subsequently remove the 'list' member of sk_buff. Most users of skb_queue_len() want to know if the queue is empty or not, and that's trivially done with skb_queue_empty() which doesn't use the skb_queue_head->qlen member and instead uses the queue list emptyness as the test. Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a92b7b8 commit b03efcf

34 files changed

Lines changed: 84 additions & 89 deletions

File tree

‎drivers/bluetooth/hci_vhci.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static unsigned int hci_vhci_chr_poll(struct file *file, poll_table * wait)
120120

121121
poll_wait(file, &hci_vhci->read_wait, wait);
122122

123-
if (skb_queue_len(&hci_vhci->readq))
123+
if (!skb_queue_empty(&hci_vhci->readq))
124124
return POLLIN | POLLRDNORM;
125125

126126
return POLLOUT | POLLWRNORM;

‎drivers/isdn/hisax/isdnl1.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ BChannel_proc_xmt(struct BCState *bcs)
279279
if (test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags))
280280
st->l1.l1l2(st, PH_PULL | CONFIRM, NULL);
281281
if (!test_bit(BC_FLG_ACTIV, &bcs->Flag)) {
282-
if (!test_bit(BC_FLG_BUSY, &bcs->Flag) && (!skb_queue_len(&bcs->squeue))) {
282+
if (!test_bit(BC_FLG_BUSY, &bcs->Flag) &&
283+
skb_queue_empty(&bcs->squeue)) {
283284
st->l2.l2l1(st, PH_DEACTIVATE | CONFIRM, NULL);
284285
}
285286
}

‎drivers/isdn/hisax/isdnl2.c‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ static int l2addrsize(struct Layer2 *l2);
108108
static void
109109
set_peer_busy(struct Layer2 *l2) {
110110
test_and_set_bit(FLG_PEER_BUSY, &l2->flag);
111-
if (skb_queue_len(&l2->i_queue) || skb_queue_len(&l2->ui_queue))
111+
if (!skb_queue_empty(&l2->i_queue) ||
112+
!skb_queue_empty(&l2->ui_queue))
112113
test_and_set_bit(FLG_L2BLOCK, &l2->flag);
113114
}
114115

@@ -754,7 +755,7 @@ l2_restart_multi(struct FsmInst *fi, int event, void *arg)
754755
st->l2.l2l3(st, DL_ESTABLISH | INDICATION, NULL);
755756

756757
if ((ST_L2_7==state) || (ST_L2_8 == state))
757-
if (skb_queue_len(&st->l2.i_queue) && cansend(st))
758+
if (!skb_queue_empty(&st->l2.i_queue) && cansend(st))
758759
st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
759760
}
760761

@@ -810,7 +811,7 @@ l2_connected(struct FsmInst *fi, int event, void *arg)
810811
if (pr != -1)
811812
st->l2.l2l3(st, pr, NULL);
812813

813-
if (skb_queue_len(&st->l2.i_queue) && cansend(st))
814+
if (!skb_queue_empty(&st->l2.i_queue) && cansend(st))
814815
st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
815816
}
816817

@@ -1014,7 +1015,7 @@ l2_st7_got_super(struct FsmInst *fi, int event, void *arg)
10141015
if(typ != RR) FsmDelTimer(&st->l2.t203, 9);
10151016
restart_t200(st, 12);
10161017
}
1017-
if (skb_queue_len(&st->l2.i_queue) && (typ == RR))
1018+
if (!skb_queue_empty(&st->l2.i_queue) && (typ == RR))
10181019
st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
10191020
} else
10201021
nrerrorrecovery(fi);
@@ -1120,7 +1121,7 @@ l2_got_iframe(struct FsmInst *fi, int event, void *arg)
11201121
return;
11211122
}
11221123

1123-
if (skb_queue_len(&st->l2.i_queue) && (fi->state == ST_L2_7))
1124+
if (!skb_queue_empty(&st->l2.i_queue) && (fi->state == ST_L2_7))
11241125
st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
11251126
if (test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag))
11261127
enquiry_cr(st, RR, RSP, 0);
@@ -1138,7 +1139,7 @@ l2_got_tei(struct FsmInst *fi, int event, void *arg)
11381139
test_and_set_bit(FLG_L3_INIT, &st->l2.flag);
11391140
} else
11401141
FsmChangeState(fi, ST_L2_4);
1141-
if (skb_queue_len(&st->l2.ui_queue))
1142+
if (!skb_queue_empty(&st->l2.ui_queue))
11421143
tx_ui(st);
11431144
}
11441145

@@ -1301,7 +1302,7 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg)
13011302
FsmDelTimer(&st->l2.t203, 13);
13021303
FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 11);
13031304
}
1304-
if (skb_queue_len(&l2->i_queue) && cansend(st))
1305+
if (!skb_queue_empty(&l2->i_queue) && cansend(st))
13051306
st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
13061307
}
13071308

@@ -1347,7 +1348,7 @@ l2_st8_got_super(struct FsmInst *fi, int event, void *arg)
13471348
}
13481349
invoke_retransmission(st, nr);
13491350
FsmChangeState(fi, ST_L2_7);
1350-
if (skb_queue_len(&l2->i_queue) && cansend(st))
1351+
if (!skb_queue_empty(&l2->i_queue) && cansend(st))
13511352
st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
13521353
} else
13531354
nrerrorrecovery(fi);

‎drivers/isdn/hisax/isdnl3.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ release_l3_process(struct l3_process *p)
302302
!test_bit(FLG_PTP, &p->st->l2.flag)) {
303303
if (p->debug)
304304
l3_debug(p->st, "release_l3_process: last process");
305-
if (!skb_queue_len(&p->st->l3.squeue)) {
305+
if (skb_queue_empty(&p->st->l3.squeue)) {
306306
if (p->debug)
307307
l3_debug(p->st, "release_l3_process: release link");
308308
if (p->st->protocol != ISDN_PTYPE_NI1)

‎drivers/isdn/i4l/isdn_tty.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ isdn_tty_write(struct tty_struct *tty, const u_char * buf, int count)
12231223
total += c;
12241224
}
12251225
atomic_dec(&info->xmit_lock);
1226-
if ((info->xmit_count) || (skb_queue_len(&info->xmit_queue))) {
1226+
if ((info->xmit_count) || !skb_queue_empty(&info->xmit_queue)) {
12271227
if (m->mdmreg[REG_DXMT] & BIT_DXMT) {
12281228
isdn_tty_senddown(info);
12291229
isdn_tty_tint(info);
@@ -1284,7 +1284,7 @@ isdn_tty_flush_chars(struct tty_struct *tty)
12841284

12851285
if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_flush_chars"))
12861286
return;
1287-
if ((info->xmit_count) || (skb_queue_len(&info->xmit_queue)))
1287+
if ((info->xmit_count) || !skb_queue_empty(&info->xmit_queue))
12881288
isdn_timer_ctrl(ISDN_TIMER_MODEMXMIT, 1);
12891289
}
12901290

‎drivers/isdn/icn/icn.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,12 @@ icn_pollbchan_send(int channel, icn_card * card)
304304
isdn_ctrl cmd;
305305

306306
if (!(card->sndcount[channel] || card->xskb[channel] ||
307-
skb_queue_len(&card->spqueue[channel])))
307+
!skb_queue_empty(&card->spqueue[channel])))
308308
return;
309309
if (icn_trymaplock_channel(card, mch)) {
310310
while (sbfree &&
311311
(card->sndcount[channel] ||
312-
skb_queue_len(&card->spqueue[channel]) ||
312+
!skb_queue_empty(&card->spqueue[channel]) ||
313313
card->xskb[channel])) {
314314
spin_lock_irqsave(&card->lock, flags);
315315
if (card->xmit_lock[channel]) {

‎drivers/net/hamradio/scc.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ static inline void scc_discard_buffers(struct scc_channel *scc)
304304
scc->tx_buff = NULL;
305305
}
306306

307-
while (skb_queue_len(&scc->tx_queue))
307+
while (!skb_queue_empty(&scc->tx_queue))
308308
dev_kfree_skb(skb_dequeue(&scc->tx_queue));
309309

310310
spin_unlock_irqrestore(&scc->lock, flags);
@@ -1126,8 +1126,7 @@ static void t_dwait(unsigned long channel)
11261126

11271127
if (scc->stat.tx_state == TXS_WAIT) /* maxkeyup or idle timeout */
11281128
{
1129-
if (skb_queue_len(&scc->tx_queue) == 0) /* nothing to send */
1130-
{
1129+
if (skb_queue_empty(&scc->tx_queue)) { /* nothing to send */
11311130
scc->stat.tx_state = TXS_IDLE;
11321131
netif_wake_queue(scc->dev); /* t_maxkeyup locked it. */
11331132
return;

‎drivers/net/ppp_async.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf,
364364
spin_lock_irqsave(&ap->recv_lock, flags);
365365
ppp_async_input(ap, buf, cflags, count);
366366
spin_unlock_irqrestore(&ap->recv_lock, flags);
367-
if (skb_queue_len(&ap->rqueue))
367+
if (!skb_queue_empty(&ap->rqueue))
368368
tasklet_schedule(&ap->tsk);
369369
ap_put(ap);
370370
if (test_and_clear_bit(TTY_THROTTLED, &tty->flags)

‎drivers/net/ppp_generic.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,8 +1237,8 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
12371237
pch = list_entry(list, struct channel, clist);
12381238
navail += pch->avail = (pch->chan != NULL);
12391239
if (pch->avail) {
1240-
if (skb_queue_len(&pch->file.xq) == 0
1241-
|| !pch->had_frag) {
1240+
if (skb_queue_empty(&pch->file.xq) ||
1241+
!pch->had_frag) {
12421242
pch->avail = 2;
12431243
++nfree;
12441244
}
@@ -1374,8 +1374,8 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
13741374

13751375
/* try to send it down the channel */
13761376
chan = pch->chan;
1377-
if (skb_queue_len(&pch->file.xq)
1378-
|| !chan->ops->start_xmit(chan, frag))
1377+
if (!skb_queue_empty(&pch->file.xq) ||
1378+
!chan->ops->start_xmit(chan, frag))
13791379
skb_queue_tail(&pch->file.xq, frag);
13801380
pch->had_frag = 1;
13811381
p += flen;
@@ -1412,7 +1412,7 @@ ppp_channel_push(struct channel *pch)
14121412

14131413
spin_lock_bh(&pch->downl);
14141414
if (pch->chan != 0) {
1415-
while (skb_queue_len(&pch->file.xq) > 0) {
1415+
while (!skb_queue_empty(&pch->file.xq)) {
14161416
skb = skb_dequeue(&pch->file.xq);
14171417
if (!pch->chan->ops->start_xmit(pch->chan, skb)) {
14181418
/* put the packet back and try again later */
@@ -1426,7 +1426,7 @@ ppp_channel_push(struct channel *pch)
14261426
}
14271427
spin_unlock_bh(&pch->downl);
14281428
/* see if there is anything from the attached unit to be sent */
1429-
if (skb_queue_len(&pch->file.xq) == 0) {
1429+
if (skb_queue_empty(&pch->file.xq)) {
14301430
read_lock_bh(&pch->upl);
14311431
ppp = pch->ppp;
14321432
if (ppp != 0)

‎drivers/net/ppp_synctty.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf,
406406
spin_lock_irqsave(&ap->recv_lock, flags);
407407
ppp_sync_input(ap, buf, cflags, count);
408408
spin_unlock_irqrestore(&ap->recv_lock, flags);
409-
if (skb_queue_len(&ap->rqueue))
409+
if (!skb_queue_empty(&ap->rqueue))
410410
tasklet_schedule(&ap->tsk);
411411
sp_put(ap);
412412
if (test_and_clear_bit(TTY_THROTTLED, &tty->flags)

0 commit comments

Comments
 (0)