From: 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: Thomas Gleixner Acked-by: Ingo Molnar Signed-off-by: Andrew Morton --- 25-akpm/drivers/ieee1394/csr.c | 2 +- 25-akpm/drivers/ieee1394/pcilynx.c | 10 +++++----- 25-akpm/drivers/ieee1394/sbp2.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff -puN drivers/ieee1394/csr.c~lock-initializer-unifying-batch-2-firewire drivers/ieee1394/csr.c --- 25/drivers/ieee1394/csr.c~lock-initializer-unifying-batch-2-firewire Thu Oct 28 15:54:00 2004 +++ 25-akpm/drivers/ieee1394/csr.c Thu Oct 28 15:54:00 2004 @@ -201,7 +201,7 @@ static void add_host(struct hpsb_host *h CSR_REGISTER_BASE + CSR_SPEED_MAP, 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.node_ids = 0; diff -puN drivers/ieee1394/pcilynx.c~lock-initializer-unifying-batch-2-firewire drivers/ieee1394/pcilynx.c --- 25/drivers/ieee1394/pcilynx.c~lock-initializer-unifying-batch-2-firewire Thu Oct 28 15:54:00 2004 +++ 25-akpm/drivers/ieee1394/pcilynx.c Thu Oct 28 15:54:00 2004 @@ -1546,8 +1546,8 @@ static int __devinit add_card(struct pci host->pdev = dev; pci_set_drvdata(dev, lynx); - lynx->lock = SPIN_LOCK_UNLOCKED; - lynx->phy_reg_lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&lynx->lock); + spin_lock_init(&lynx->phy_reg_lock); #ifndef CONFIG_IEEE1394_PCILYNX_LOCALRAM lynx->pcl_mem = pci_alloc_consistent(dev, LOCALRAM_SIZE, @@ -1659,11 +1659,11 @@ static int __devinit add_card(struct pci tasklet_init(&lynx->iso_rcv.tq, (void (*)(unsigned long))iso_rcv_bh, (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->iso_send.queue_lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&lynx->iso_send.queue_lock); lynx->iso_send.channel = CHANNEL_ISO_SEND; PRINT(KERN_INFO, lynx->id, "remapped memory spaces reg 0x%p, rom 0x%p, " diff -puN drivers/ieee1394/sbp2.c~lock-initializer-unifying-batch-2-firewire drivers/ieee1394/sbp2.c --- 25/drivers/ieee1394/sbp2.c~lock-initializer-unifying-batch-2-firewire Thu Oct 28 15:54:00 2004 +++ 25-akpm/drivers/ieee1394/sbp2.c Thu Oct 28 15:54:00 2004 @@ -708,7 +708,7 @@ static struct scsi_id_instance_data *sbp INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_inuse); INIT_LIST_HEAD(&scsi_id->sbp2_command_orb_completed); 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; ud->device.driver_data = scsi_id; _