[PATCH 3/4] [MTD] physmap: Fix suspend/resume/shutdown bugs.
Uwe Kleine-König
Uwe.Kleine-Koenig at digi.com
Tue Jul 22 03:39:00 EDT 2008
From: Robert Jarzmik <rjarzmik at free.fr>
Don't call suspend/resume functions if they have not been
defined.
Signed-off-by: Robert Jarzmik <rjarzmik at free.fr>
Acked-By: Joern Engel <joern at logfs.org>
Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig at digi.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 183255f..73c770b 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -203,7 +203,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;
}
@@ -214,7 +215,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;
}
@@ -225,8 +227,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
--
1.5.6.3
More information about the linux-mtd
mailing list