Skip to content

Commit

Permalink
hci_usb: replace mb with smp_mb
Browse files Browse the repository at this point in the history
smp_mb is enough for ordering memory operations among processors,and mb is
more expensive than smp_mb for UP machine, so replace it with smp_mb().

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ming Lei authored and David S. Miller committed Sep 23, 2008
1 parent d48abfe commit ca330c5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/bluetooth/hci_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ static inline void _urb_queue_head(struct _urb_queue *q, struct _urb *_urb)
{
unsigned long flags;
spin_lock_irqsave(&q->lock, flags);
/* _urb_unlink needs to know which spinlock to use, thus mb(). */
_urb->queue = q; mb(); list_add(&_urb->list, &q->head);
/* _urb_unlink needs to know which spinlock to use, thus smp_mb(). */
_urb->queue = q; smp_mb(); list_add(&_urb->list, &q->head);
spin_unlock_irqrestore(&q->lock, flags);
}

static inline void _urb_queue_tail(struct _urb_queue *q, struct _urb *_urb)
{
unsigned long flags;
spin_lock_irqsave(&q->lock, flags);
/* _urb_unlink needs to know which spinlock to use, thus mb(). */
_urb->queue = q; mb(); list_add_tail(&_urb->list, &q->head);
/* _urb_unlink needs to know which spinlock to use, thus smp_mb(). */
_urb->queue = q; smp_mb(); list_add_tail(&_urb->list, &q->head);
spin_unlock_irqrestore(&q->lock, flags);
}

Expand All @@ -89,7 +89,7 @@ static inline void _urb_unlink(struct _urb *_urb)
struct _urb_queue *q;
unsigned long flags;

mb();
smp_mb();
q = _urb->queue;
/* If q is NULL, it will die at easy-to-debug NULL pointer dereference.
No need to BUG(). */
Expand Down

0 comments on commit ca330c5

Please sign in to comment.