Commit 04bbd0ea authored by Thomas Gleixner's avatar Thomas Gleixner Committed by David Woodhouse

[MTD] NAND Initialize controller lock and wq only once

The lock simplifying patch did not move the lock and waitqueue
initialization into the controller allocation patch.
This reinitializes waitqueue and spinlocks also for driver
supplied controller stuctures. Move it into the allocation path.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 8b9e9fe8
...@@ -2125,6 +2125,9 @@ static int nand_allocate_kmem(struct mtd_info *mtd, struct nand_chip *chip) ...@@ -2125,6 +2125,9 @@ static int nand_allocate_kmem(struct mtd_info *mtd, struct nand_chip *chip)
GFP_KERNEL); GFP_KERNEL);
if (!chip->controller) if (!chip->controller)
goto outerr; goto outerr;
spin_lock_init(&chip->controller->lock);
init_waitqueue_head(&chip->controller->wq);
chip->options |= NAND_CONTROLLER_ALLOC; chip->options |= NAND_CONTROLLER_ALLOC;
} }
return 0; return 0;
...@@ -2451,10 +2454,8 @@ int nand_scan(struct mtd_info *mtd, int maxchips) ...@@ -2451,10 +2454,8 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
BUG(); BUG();
} }
/* Initialize state, waitqueue and spinlock */ /* Initialize state */
chip->state = FL_READY; chip->state = FL_READY;
init_waitqueue_head(&chip->controller->wq);
spin_lock_init(&chip->controller->lock);
/* De-select the device */ /* De-select the device */
chip->select_chip(mtd, -1); chip->select_chip(mtd, -1);
......
...@@ -293,8 +293,12 @@ static struct platform_driver ndfc_nand_driver = { ...@@ -293,8 +293,12 @@ static struct platform_driver ndfc_nand_driver = {
static int __init ndfc_nand_init(void) static int __init ndfc_nand_init(void)
{ {
int ret = platform_driver_register(&ndfc_nand_driver); int ret;
spin_lock_init(&ndfc_ctrl.ndfc_control.lock);
init_waitqueue_head(&ndfc_ctrl.ndfc_control.wq);
ret = platform_driver_register(&ndfc_nand_driver);
if (!ret) if (!ret)
ret = platform_driver_register(&ndfc_chip_driver); ret = platform_driver_register(&ndfc_chip_driver);
return ret; return ret;
......
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