From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-fx0-f223.google.com ([209.85.220.223]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NgHes-0001dt-2Z for linux-mtd@lists.infradead.org; Sat, 13 Feb 2010 13:03:42 +0000 Received: by mail-fx0-f223.google.com with SMTP id 23so3374278fxm.2 for ; Sat, 13 Feb 2010 05:03:37 -0800 (PST) From: Maxim Levitsky To: David Woodhouse Subject: [PATCH 06/14] MTD: nand: make suspend work if device is accessed by kernel threads. Date: Sat, 13 Feb 2010 15:03:05 +0200 Message-Id: <1266066193-17625-7-git-send-email-maximlevitsky@gmail.com> In-Reply-To: <1266066193-17625-1-git-send-email-maximlevitsky@gmail.com> References: <1266066193-17625-1-git-send-email-maximlevitsky@gmail.com> Cc: Maxim Levitsky , Alex Dubov , Artem Bityutskiy , joern , Vitaly Wool , linux-kernel , "stanley.miao" , linux-mtd , Thomas Gleixner List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Since all userspace threads are frozen at the time the nand_suspend is called, they aren't inside any nand function. We don't call try_to_freeze in nand ether. Thus the only user that can be inside the nand functions is an non freezeable kernel thread. Thus we can safely wait for it to finish. Signed-off-by: Maxim Levitsky --- drivers/mtd/nand/nand_base.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 8f2958f..279b960 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -744,9 +744,6 @@ nand_get_device(struct nand_chip *chip, struct mtd_info *mtd, int new_state) chip->state = FL_PM_SUSPENDED; spin_unlock(lock); return 0; - } else { - spin_unlock(lock); - return -EAGAIN; } } set_current_state(TASK_UNINTERRUPTIBLE); -- 1.6.3.3