[MTD] physmap: Fix suspend/resume/shutdown bugs.

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Jul 25 10:59:02 EDT 2008


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=7b2491911540e4904498622fbee2e1a9e3120d2f
Commit:     7b2491911540e4904498622fbee2e1a9e3120d2f
Parent:     998453fbf2e0709bf65ac419718ad284401b2b4f
Author:     Robert Jarzmik <rjarzmik at free.fr>
AuthorDate: Tue Jul 22 09:39:00 2008 +0200
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Jul 25 09:53:03 2008 -0400

    [MTD] physmap: Fix suspend/resume/shutdown bugs.
    
    Don't call suspend/resume functions if they have not been
    defined.
    
    Signed-off-by: Robert Jarzmik <rjarzmik at free.fr>
    Acked-By: Jörn Engel <joern at logfs.org>
    Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig at digi.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/maps/physmap.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index 1f6b906..7c8cdf4 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -201,7 +201,8 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state
 	int i;
 
 	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
-		ret |= info->mtd[i]->suspend(info->mtd[i]);
+		if (info->mtd[i]->suspend)
+			ret |= info->mtd[i]->suspend(info->mtd[i]);
 
 	return ret;
 }
@@ -212,7 +213,8 @@ static int physmap_flash_resume(struct platform_device *dev)
 	int i;
 
 	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
-		info->mtd[i]->resume(info->mtd[i]);
+		if (info->mtd[i]->resume)
+			info->mtd[i]->resume(info->mtd[i]);
 
 	return 0;
 }
@@ -223,8 +225,9 @@ static void physmap_flash_shutdown(struct platform_device *dev)
 	int i;
 
 	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
-		if (info->mtd[i]->suspend(info->mtd[i]) == 0)
-			info->mtd[i]->resume(info->mtd[i]);
+		if (info->mtd[i]->suspend && info->mtd[i]->resume)
+			if (info->mtd[i]->suspend(info->mtd[i]) == 0)
+				info->mtd[i]->resume(info->mtd[i]);
 }
 #else
 #define physmap_flash_suspend NULL



More information about the linux-mtd-cvs mailing list