diff options
Diffstat (limited to 'drivers/mtd/maps/physmap.c')
| -rw-r--r-- | drivers/mtd/maps/physmap.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 183255fcfdcb..42d844f8f6bf 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
| @@ -1,6 +1,4 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * $Id: physmap.c,v 1.39 2005/11/29 14:49:36 gleixner Exp $ | ||
| 3 | * | ||
| 4 | * Normal mappings of chips in physical memory | 2 | * Normal mappings of chips in physical memory |
| 5 | * | 3 | * |
| 6 | * Copyright (C) 2003 MontaVista Software Inc. | 4 | * Copyright (C) 2003 MontaVista Software Inc. |
| @@ -203,7 +201,19 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state | |||
| 203 | int i; | 201 | int i; |
| 204 | 202 | ||
| 205 | for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) | 203 | for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) |
| 206 | ret |= info->mtd[i]->suspend(info->mtd[i]); | 204 | if (info->mtd[i]->suspend) { |
| 205 | ret = info->mtd[i]->suspend(info->mtd[i]); | ||
| 206 | if (ret) | ||
| 207 | goto fail; | ||
| 208 | } | ||
| 209 | |||
| 210 | return 0; | ||
| 211 | fail: | ||
| 212 | for (--i; i >= 0; --i) | ||
| 213 | if (info->mtd[i]->suspend) { | ||
| 214 | BUG_ON(!info->mtd[i]->resume); | ||
| 215 | info->mtd[i]->resume(info->mtd[i]); | ||
| 216 | } | ||
| 207 | 217 | ||
| 208 | return ret; | 218 | return ret; |
| 209 | } | 219 | } |
| @@ -214,7 +224,8 @@ static int physmap_flash_resume(struct platform_device *dev) | |||
| 214 | int i; | 224 | int i; |
| 215 | 225 | ||
| 216 | for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) | 226 | for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) |
| 217 | info->mtd[i]->resume(info->mtd[i]); | 227 | if (info->mtd[i]->resume) |
| 228 | info->mtd[i]->resume(info->mtd[i]); | ||
| 218 | 229 | ||
| 219 | return 0; | 230 | return 0; |
| 220 | } | 231 | } |
| @@ -225,8 +236,9 @@ static void physmap_flash_shutdown(struct platform_device *dev) | |||
| 225 | int i; | 236 | int i; |
| 226 | 237 | ||
| 227 | for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) | 238 | for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) |
| 228 | if (info->mtd[i]->suspend(info->mtd[i]) == 0) | 239 | if (info->mtd[i]->suspend && info->mtd[i]->resume) |
| 229 | info->mtd[i]->resume(info->mtd[i]); | 240 | if (info->mtd[i]->suspend(info->mtd[i]) == 0) |
| 241 | info->mtd[i]->resume(info->mtd[i]); | ||
| 230 | } | 242 | } |
| 231 | #else | 243 | #else |
| 232 | #define physmap_flash_suspend NULL | 244 | #define physmap_flash_suspend NULL |
