Skip to content

Commit

Permalink
[MTD] NAND Initialize controller lock and wq only once
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Gleixner authored and David Woodhouse committed May 25, 2006
1 parent 8b9e9fe commit 04bbd0e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions drivers/mtd/nand/nand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2125,6 +2125,9 @@ static int nand_allocate_kmem(struct mtd_info *mtd, struct nand_chip *chip)
GFP_KERNEL);
if (!chip->controller)
goto outerr;

spin_lock_init(&chip->controller->lock);
init_waitqueue_head(&chip->controller->wq);
chip->options |= NAND_CONTROLLER_ALLOC;
}
return 0;
Expand Down Expand Up @@ -2451,10 +2454,8 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
BUG();
}

/* Initialize state, waitqueue and spinlock */
/* Initialize state */
chip->state = FL_READY;
init_waitqueue_head(&chip->controller->wq);
spin_lock_init(&chip->controller->lock);

/* De-select the device */
chip->select_chip(mtd, -1);
Expand Down
6 changes: 5 additions & 1 deletion drivers/mtd/nand/ndfc.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,12 @@ static struct platform_driver ndfc_nand_driver = {

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)
ret = platform_driver_register(&ndfc_chip_driver);
return ret;
Expand Down

0 comments on commit 04bbd0e

Please sign in to comment.