diff options
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r-- | drivers/bluetooth/hci_bcsp.c | 18 | ||||
-rw-r--r-- | drivers/bluetooth/hci_usb.h | 10 |
2 files changed, 14 insertions, 14 deletions
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c index 4d37bb312ee3..7938062c1cc7 100644 --- a/drivers/bluetooth/hci_bcsp.c +++ b/drivers/bluetooth/hci_bcsp.c | |||
@@ -352,14 +352,14 @@ static int bcsp_flush(struct hci_uart *hu) | |||
352 | /* Remove ack'ed packets */ | 352 | /* Remove ack'ed packets */ |
353 | static void bcsp_pkt_cull(struct bcsp_struct *bcsp) | 353 | static void bcsp_pkt_cull(struct bcsp_struct *bcsp) |
354 | { | 354 | { |
355 | struct sk_buff *skb, *tmp; | ||
355 | unsigned long flags; | 356 | unsigned long flags; |
356 | struct sk_buff *skb; | ||
357 | int i, pkts_to_be_removed; | 357 | int i, pkts_to_be_removed; |
358 | u8 seqno; | 358 | u8 seqno; |
359 | 359 | ||
360 | spin_lock_irqsave(&bcsp->unack.lock, flags); | 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 | seqno = bcsp->msgq_txseq; | 363 | seqno = bcsp->msgq_txseq; |
364 | 364 | ||
365 | while (pkts_to_be_removed) { | 365 | while (pkts_to_be_removed) { |
@@ -373,19 +373,19 @@ static void bcsp_pkt_cull(struct bcsp_struct *bcsp) | |||
373 | BT_ERR("Peer acked invalid packet"); | 373 | BT_ERR("Peer acked invalid packet"); |
374 | 374 | ||
375 | BT_DBG("Removing %u pkts out of %u, up to seqno %u", | 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 | i = 0; |
379 | && skb != (struct sk_buff *) &bcsp->unack; i++) { | 380 | skb_queue_walk_safe(&bcsp->unack, skb, tmp) { |
380 | struct sk_buff *nskb; | 381 | if (i++ >= pkts_to_be_removed) |
382 | break; | ||
381 | 383 | ||
382 | nskb = skb->next; | ||
383 | __skb_unlink(skb, &bcsp->unack); | 384 | __skb_unlink(skb, &bcsp->unack); |
384 | kfree_skb(skb); | 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 | del_timer(&bcsp->tbcsp); | 389 | del_timer(&bcsp->tbcsp); |
390 | 390 | ||
391 | spin_unlock_irqrestore(&bcsp->unack.lock, flags); | 391 | spin_unlock_irqrestore(&bcsp->unack.lock, flags); |
diff --git a/drivers/bluetooth/hci_usb.h b/drivers/bluetooth/hci_usb.h index 1790cc8e431e..8e659914523f 100644 --- a/drivers/bluetooth/hci_usb.h +++ b/drivers/bluetooth/hci_usb.h | |||
@@ -70,8 +70,8 @@ static inline void _urb_queue_head(struct _urb_queue *q, struct _urb *_urb) | |||
70 | { | 70 | { |
71 | unsigned long flags; | 71 | unsigned long flags; |
72 | spin_lock_irqsave(&q->lock, flags); | 72 | spin_lock_irqsave(&q->lock, flags); |
73 | /* _urb_unlink needs to know which spinlock to use, thus mb(). */ | 73 | /* _urb_unlink needs to know which spinlock to use, thus smp_mb(). */ |
74 | _urb->queue = q; mb(); list_add(&_urb->list, &q->head); | 74 | _urb->queue = q; smp_mb(); list_add(&_urb->list, &q->head); |
75 | spin_unlock_irqrestore(&q->lock, flags); | 75 | spin_unlock_irqrestore(&q->lock, flags); |
76 | } | 76 | } |
77 | 77 | ||
@@ -79,8 +79,8 @@ static inline void _urb_queue_tail(struct _urb_queue *q, struct _urb *_urb) | |||
79 | { | 79 | { |
80 | unsigned long flags; | 80 | unsigned long flags; |
81 | spin_lock_irqsave(&q->lock, flags); | 81 | spin_lock_irqsave(&q->lock, flags); |
82 | /* _urb_unlink needs to know which spinlock to use, thus mb(). */ | 82 | /* _urb_unlink needs to know which spinlock to use, thus smp_mb(). */ |
83 | _urb->queue = q; mb(); list_add_tail(&_urb->list, &q->head); | 83 | _urb->queue = q; smp_mb(); list_add_tail(&_urb->list, &q->head); |
84 | spin_unlock_irqrestore(&q->lock, flags); | 84 | spin_unlock_irqrestore(&q->lock, flags); |
85 | } | 85 | } |
86 | 86 | ||
@@ -89,7 +89,7 @@ static inline void _urb_unlink(struct _urb *_urb) | |||
89 | struct _urb_queue *q; | 89 | struct _urb_queue *q; |
90 | unsigned long flags; | 90 | unsigned long flags; |
91 | 91 | ||
92 | mb(); | 92 | smp_mb(); |
93 | q = _urb->queue; | 93 | q = _urb->queue; |
94 | /* If q is NULL, it will die at easy-to-debug NULL pointer dereference. | 94 | /* If q is NULL, it will die at easy-to-debug NULL pointer dereference. |
95 | No need to BUG(). */ | 95 | No need to BUG(). */ |