From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-bw0-f220.google.com ([209.85.218.220]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NetPt-000351-6Q for linux-mtd@lists.infradead.org; Tue, 09 Feb 2010 16:58:31 +0000 Received: by mail-bw0-f220.google.com with SMTP id 20so2398617bwz.20 for ; Tue, 09 Feb 2010 08:58:24 -0800 (PST) From: Maxim Levitsky To: David Woodhouse Subject: [PATCH 11/17] MTD: nand: make suspend work if device is accessed by kernel threads. Date: Tue, 9 Feb 2010 18:57:39 +0200 Message-Id: <1265734665-22656-12-git-send-email-maximlevitsky@gmail.com> In-Reply-To: <1265734665-22656-1-git-send-email-maximlevitsky@gmail.com> References: <1265734665-22656-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 insize 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 64b0f10..2ff9c02 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755276Ab0BIQ63 (ORCPT ); Tue, 9 Feb 2010 11:58:29 -0500 Received: from mail-bw0-f223.google.com ([209.85.218.223]:38923 "EHLO mail-bw0-f223.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755263Ab0BIQ6Z (ORCPT ); Tue, 9 Feb 2010 11:58:25 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=x4ttyU/InKCZB3/zs6JPIDRA2ZCk+Sr3Zya/iWDoJkr+JTt0a9TEMmQ85Lo4eE/vgN FPs5qd+ds5RpmW++kF6EZEzxwIJUnS3WuCxnjE4CQ4eG/0Ik+vWYOib9smKHW03Bl9/W mQ9Y2oENQJhpe1GkVe2jLgk3+cylWFDTY56eU= From: Maxim Levitsky To: David Woodhouse Cc: Artem Bityutskiy , linux-mtd , linux-kernel , Alex Dubov , joern , Thomas Gleixner , "stanley.miao" , Vitaly Wool , Maxim Levitsky Subject: [PATCH 11/17] MTD: nand: make suspend work if device is accessed by kernel threads. Date: Tue, 9 Feb 2010 18:57:39 +0200 Message-Id: <1265734665-22656-12-git-send-email-maximlevitsky@gmail.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1265734665-22656-1-git-send-email-maximlevitsky@gmail.com> References: <1265734665-22656-1-git-send-email-maximlevitsky@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 insize 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 64b0f10..2ff9c02 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