Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bluetooth: hci_bcsp: Use SKB list interfaces instead of home-grown stuff.

Signed-off-by: David S. Miller <davem@davemloft.net>

+9 -9
+9 -9
drivers/bluetooth/hci_bcsp.c
··· 352 352 /* Remove ack'ed packets */ 353 353 static void bcsp_pkt_cull(struct bcsp_struct *bcsp) 354 354 { 355 + struct sk_buff *skb, *tmp; 355 356 unsigned long flags; 356 - struct sk_buff *skb; 357 357 int i, pkts_to_be_removed; 358 358 u8 seqno; 359 359 360 360 spin_lock_irqsave(&bcsp->unack.lock, flags); 361 361 362 - pkts_to_be_removed = bcsp->unack.qlen; 362 + pkts_to_be_removed = skb_queue_len(&bcsp->unack); 363 363 seqno = bcsp->msgq_txseq; 364 364 365 365 while (pkts_to_be_removed) { ··· 373 373 BT_ERR("Peer acked invalid packet"); 374 374 375 375 BT_DBG("Removing %u pkts out of %u, up to seqno %u", 376 - pkts_to_be_removed, bcsp->unack.qlen, (seqno - 1) & 0x07); 376 + pkts_to_be_removed, skb_queue_len(&bcsp->unack), 377 + (seqno - 1) & 0x07); 377 378 378 - for (i = 0, skb = ((struct sk_buff *) &bcsp->unack)->next; i < pkts_to_be_removed 379 - && skb != (struct sk_buff *) &bcsp->unack; i++) { 380 - struct sk_buff *nskb; 379 + i = 0; 380 + skb_queue_walk_safe(&bcsp->unack, skb, tmp) { 381 + if (i++ >= pkts_to_be_removed) 382 + break; 381 383 382 - nskb = skb->next; 383 384 __skb_unlink(skb, &bcsp->unack); 384 385 kfree_skb(skb); 385 - skb = nskb; 386 386 } 387 387 388 - if (bcsp->unack.qlen == 0) 388 + if (skb_queue_empty(&bcsp->unack)) 389 389 del_timer(&bcsp->tbcsp); 390 390 391 391 spin_unlock_irqrestore(&bcsp->unack.lock, flags);