Commit 8452fcd1 authored by Andrew Morton's avatar Andrew Morton Committed by David S. Miller

[BLUETOOTH]: Lock initializer unifying

From: <tglx@linutronix.de>

To make spinlock/rwlock initialization consistent all over the kernel,
this patch converts explicit lock-initializers into spin_lock_init() and
rwlock_init() calls.

Currently, spinlocks and rwlocks are initialized in two different ways:

  lock = SPIN_LOCK_UNLOCKED
  spin_lock_init(&lock)
  
  rwlock = RW_LOCK_UNLOCKED
  rwlock_init(&rwlock)

this patch converts all explicit lock initializations to
spin_lock_init() or rwlock_init(). (Besides consistency this also helps
automatic lock validators and debugging code.)

The conversion was done with a script, it was verified manually and it
was reviewed, compiled and tested as far as possible on x86, ARM, PPC.

There is no runtime overhead or actual code change resulting out of this
patch, because spin_lock_init() and rwlock_init() are macros and are
thus equivalent to the explicit initialization method.

That's the second batch of the unifying patches.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1d49f2e7
...@@ -680,7 +680,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i ...@@ -680,7 +680,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
bfusb->bulk_out_ep = bulk_out_ep->desc.bEndpointAddress; bfusb->bulk_out_ep = bulk_out_ep->desc.bEndpointAddress;
bfusb->bulk_pkt_size = bulk_out_ep->desc.wMaxPacketSize; bfusb->bulk_pkt_size = bulk_out_ep->desc.wMaxPacketSize;
bfusb->lock = RW_LOCK_UNLOCKED; rwlock_init(&bfusb->lock);
bfusb->reassembly = NULL; bfusb->reassembly = NULL;
......
...@@ -933,7 +933,7 @@ static int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id ...@@ -933,7 +933,7 @@ static int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id
} }
#endif #endif
husb->completion_lock = RW_LOCK_UNLOCKED; rwlock_init(&husb->completion_lock);
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
skb_queue_head_init(&husb->transmit_q[i]); skb_queue_head_init(&husb->transmit_q[i]);
......
...@@ -134,7 +134,7 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status) ...@@ -134,7 +134,7 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status)
conn->dst = &hcon->dst; conn->dst = &hcon->dst;
spin_lock_init(&conn->lock); spin_lock_init(&conn->lock);
conn->chan_list.lock = RW_LOCK_UNLOCKED; rwlock_init(&conn->chan_list.lock);
BT_DBG("hcon %p conn %p", hcon, conn); BT_DBG("hcon %p conn %p", hcon, conn);
return conn; return conn;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment