mtd/chips: add missing set_current_state() to cfi_{amdstd,staa}_sync()
authorDmitry Adamushko <dmitry.adamushko@gmail.com>
Wed, 9 Apr 2008 00:41:59 +0000 (17:41 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 9 Apr 2008 01:25:53 +0000 (18:25 -0700)
cfi_amdstd_sync() and cfi_staa_sync() call schedule() without changing task's
state appropriately.

In case of e.g.  chip->state == FL_ERASING, cfi_*_sync() will be busy-looping
either redundantly for a fixed interval of time (for SCHED_NORMAL tasks) or
possibly endlessly (for RT tasks and UP).

Signed-off-by: Dmitry Adamushko <dmitry.adamushko@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/mtd/chips/cfi_cmdset_0002.c
drivers/mtd/chips/cfi_cmdset_0020.c

index d072e87ce4e20cec96af6220d8bd903864b8de29..458d477614d680c0fb718e20e16ee6692fc71a8a 100644 (file)
@@ -1763,6 +1763,7 @@ static void cfi_amdstd_sync (struct mtd_info *mtd)
 
                default:
                        /* Not an idle state */
+                       set_current_state(TASK_UNINTERRUPTIBLE);
                        add_wait_queue(&chip->wq, &wait);
 
                        spin_unlock(chip->mutex);
index b344ff858b2d7a6c220216050b6124b99e603e2f..492e2ab27420ff76bcc532c961452eeb75a59e32 100644 (file)
@@ -1015,6 +1015,7 @@ static void cfi_staa_sync (struct mtd_info *mtd)
 
                default:
                        /* Not an idle state */
+                       set_current_state(TASK_UNINTERRUPTIBLE);
                        add_wait_queue(&chip->wq, &wait);
 
                        spin_unlock_bh(chip->mutex);