Commit 88be4c79 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Greg Kroah-Hartman

[PATCH] Lock initializer unifying Batch 2 (USB)

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 avatarGreg Kroah-Hartman <greg@kroah.com>
parent 49ed70c7
...@@ -1702,8 +1702,8 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) ...@@ -1702,8 +1702,8 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
init_waitqueue_head(&hid->wait); init_waitqueue_head(&hid->wait);
hid->outlock = SPIN_LOCK_UNLOCKED; spin_lock_init(&hid->outlock);
hid->ctrllock = SPIN_LOCK_UNLOCKED; spin_lock_init(&hid->ctrllock);
hid->version = le16_to_cpu(hdesc->bcdHID); hid->version = le16_to_cpu(hdesc->bcdHID);
hid->country = hdesc->bCountryCode; hid->country = hdesc->bCountryCode;
......
...@@ -349,7 +349,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i ...@@ -349,7 +349,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
return -ENOMEM; return -ENOMEM;
} }
pm->lock = SPIN_LOCK_UNLOCKED; spin_lock_init(&pm->lock);
init_input_dev(&pm->input); init_input_dev(&pm->input);
/* get a handle to the interrupt data pipe */ /* get a handle to the interrupt data pipe */
......
...@@ -773,8 +773,8 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id ...@@ -773,8 +773,8 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
catc->usbdev = usbdev; catc->usbdev = usbdev;
catc->netdev = netdev; catc->netdev = netdev;
catc->tx_lock = SPIN_LOCK_UNLOCKED; spin_lock_init(&catc->tx_lock);
catc->ctrl_lock = SPIN_LOCK_UNLOCKED; spin_lock_init(&catc->ctrl_lock);
init_timer(&catc->timer); init_timer(&catc->timer);
catc->timer.data = (long) catc; catc->timer.data = (long) catc;
......
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