Commit df8f70f9 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Linus Torvalds

[PATCH] Lock initializer unifying: Firewire

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 avatarLinus Torvalds <torvalds@osdl.org>
parent e27a8a21
...@@ -201,7 +201,7 @@ static void add_host(struct hpsb_host *host) ...@@ -201,7 +201,7 @@ static void add_host(struct hpsb_host *host)
CSR_REGISTER_BASE + CSR_SPEED_MAP, CSR_REGISTER_BASE + CSR_SPEED_MAP,
CSR_REGISTER_BASE + CSR_SPEED_MAP_END); CSR_REGISTER_BASE + CSR_SPEED_MAP_END);
host->csr.lock = SPIN_LOCK_UNLOCKED; spin_lock_init(&host->csr.lock);
host->csr.state = 0; host->csr.state = 0;
host->csr.node_ids = 0; host->csr.node_ids = 0;
......
...@@ -1546,8 +1546,8 @@ static int __devinit add_card(struct pci_dev *dev, ...@@ -1546,8 +1546,8 @@ static int __devinit add_card(struct pci_dev *dev,
host->pdev = dev; host->pdev = dev;
pci_set_drvdata(dev, lynx); pci_set_drvdata(dev, lynx);
lynx->lock = SPIN_LOCK_UNLOCKED; spin_lock_init(&lynx->lock);
lynx->phy_reg_lock = SPIN_LOCK_UNLOCKED; spin_lock_init(&lynx->phy_reg_lock);
#ifndef CONFIG_IEEE1394_PCILYNX_LOCALRAM #ifndef CONFIG_IEEE1394_PCILYNX_LOCALRAM
lynx->pcl_mem = pci_alloc_consistent(dev, LOCALRAM_SIZE, lynx->pcl_mem = pci_alloc_consistent(dev, LOCALRAM_SIZE,
...@@ -1659,11 +1659,11 @@ static int __devinit add_card(struct pci_dev *dev, ...@@ -1659,11 +1659,11 @@ static int __devinit add_card(struct pci_dev *dev,
tasklet_init(&lynx->iso_rcv.tq, (void (*)(unsigned long))iso_rcv_bh, tasklet_init(&lynx->iso_rcv.tq, (void (*)(unsigned long))iso_rcv_bh,
(unsigned long)lynx); (unsigned long)lynx);
lynx->iso_rcv.lock = SPIN_LOCK_UNLOCKED; spin_lock_init(&lynx->iso_rcv.lock);
lynx->async.queue_lock = SPIN_LOCK_UNLOCKED; spin_lock_init(&lynx->async.queue_lock);
lynx->async.channel = CHANNEL_ASYNC_SEND; lynx->async.channel = CHANNEL_ASYNC_SEND;
lynx->iso_send.queue_lock = SPIN_LOCK_UNLOCKED; spin_lock_init(&lynx->iso_send.queue_lock);
lynx->iso_send.channel = CHANNEL_ISO_SEND; lynx->iso_send.channel = CHANNEL_ISO_SEND;
PRINT(KERN_INFO, lynx->id, "remapped memory spaces reg 0x%p, rom 0x%p, " PRINT(KERN_INFO, lynx->id, "remapped memory spaces reg 0x%p, rom 0x%p, "
......
...@@ -708,7 +708,7 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud ...@@ -708,7 +708,7 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud
INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_inuse); INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_inuse);
INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_completed); INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_completed);
INIT_LIST_HEAD(&scsi_id->scsi_list); INIT_LIST_HEAD(&scsi_id->scsi_list);
scsi_id->sbp2_command_orb_lock = SPIN_LOCK_UNLOCKED; spin_lock_init(&scsi_id->sbp2_command_orb_lock);
scsi_id->sbp2_device_type_and_lun = SBP2_DEVICE_TYPE_LUN_UNINITIALIZED; scsi_id->sbp2_device_type_and_lun = SBP2_DEVICE_TYPE_LUN_UNINITIALIZED;
ud->device.driver_data = scsi_id; ud->device.driver_data = scsi_id;
......
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