diff options
author | Thomas Gleixner <tglx@cruncher.tec.linutronix.de> | 2006-05-25 03:45:29 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-25 07:45:26 -0400 |
commit | 04bbd0eafb0c733c6c7f5d63c5098c615fe0685a (patch) | |
tree | e4bf0095d7a46912d13a1508ba9acd6e39fa3733 | |
parent | 8b9e9fe8c6ee354aa75dc5a33e1575b21aa52084 (diff) |
[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: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 7 | ||||
-rw-r--r-- | drivers/mtd/nand/ndfc.c | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 5690de223c11..61b2363f9324 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -2125,6 +2125,9 @@ static int nand_allocate_kmem(struct mtd_info *mtd, struct nand_chip *chip) | |||
2125 | GFP_KERNEL); | 2125 | GFP_KERNEL); |
2126 | if (!chip->controller) | 2126 | if (!chip->controller) |
2127 | goto outerr; | 2127 | goto outerr; |
2128 | |||
2129 | spin_lock_init(&chip->controller->lock); | ||
2130 | init_waitqueue_head(&chip->controller->wq); | ||
2128 | chip->options |= NAND_CONTROLLER_ALLOC; | 2131 | chip->options |= NAND_CONTROLLER_ALLOC; |
2129 | } | 2132 | } |
2130 | return 0; | 2133 | return 0; |
@@ -2451,10 +2454,8 @@ int nand_scan(struct mtd_info *mtd, int maxchips) | |||
2451 | BUG(); | 2454 | BUG(); |
2452 | } | 2455 | } |
2453 | 2456 | ||
2454 | /* Initialize state, waitqueue and spinlock */ | 2457 | /* Initialize state */ |
2455 | chip->state = FL_READY; | 2458 | chip->state = FL_READY; |
2456 | init_waitqueue_head(&chip->controller->wq); | ||
2457 | spin_lock_init(&chip->controller->lock); | ||
2458 | 2459 | ||
2459 | /* De-select the device */ | 2460 | /* De-select the device */ |
2460 | chip->select_chip(mtd, -1); | 2461 | chip->select_chip(mtd, -1); |
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c index 481541a683ca..4d70dd16cf5d 100644 --- a/drivers/mtd/nand/ndfc.c +++ b/drivers/mtd/nand/ndfc.c | |||
@@ -293,8 +293,12 @@ static struct platform_driver ndfc_nand_driver = { | |||
293 | 293 | ||
294 | static int __init ndfc_nand_init(void) | 294 | static int __init ndfc_nand_init(void) |
295 | { | 295 | { |
296 | int ret = platform_driver_register(&ndfc_nand_driver); | 296 | int ret; |
297 | 297 | ||
298 | spin_lock_init(&ndfc_ctrl.ndfc_control.lock); | ||
299 | init_waitqueue_head(&ndfc_ctrl.ndfc_control.wq); | ||
300 | |||
301 | ret = platform_driver_register(&ndfc_nand_driver); | ||
298 | if (!ret) | 302 | if (!ret) |
299 | ret = platform_driver_register(&ndfc_chip_driver); | 303 | ret = platform_driver_register(&ndfc_chip_driver); |
300 | return ret; | 304 | return ret; |