Skip to content

Commit

Permalink
[MTD] physmap: Fix suspend/resume/shutdown bugs.
Browse files Browse the repository at this point in the history
Don't call suspend/resume functions if they have not been
defined.

Signed-off-by: Robert Jarzmik <rjarzmik@free.fr>
Acked-By: Jörn Engel <joern@logfs.org>
Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Robert Jarzmik authored and David Woodhouse committed Jul 25, 2008
1 parent 998453f commit 7b24919
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/mtd/maps/physmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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
Expand Down

0 comments on commit 7b24919

Please sign in to comment.