diff options
-rw-r--r-- | drivers/s390/block/xpram.c | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c index db442cd6621e..ee604e92a5fa 100644 --- a/drivers/s390/block/xpram.c +++ b/drivers/s390/block/xpram.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <linux/suspend.h> | 42 | #include <linux/suspend.h> |
43 | #include <linux/platform_device.h> | 43 | #include <linux/platform_device.h> |
44 | #include <asm/uaccess.h> | 44 | #include <asm/uaccess.h> |
45 | #include <asm/checksum.h> | ||
46 | 45 | ||
47 | #define XPRAM_NAME "xpram" | 46 | #define XPRAM_NAME "xpram" |
48 | #define XPRAM_DEVS 1 /* one partition */ | 47 | #define XPRAM_DEVS 1 /* one partition */ |
@@ -51,7 +50,6 @@ | |||
51 | typedef struct { | 50 | typedef struct { |
52 | unsigned int size; /* size of xpram segment in pages */ | 51 | unsigned int size; /* size of xpram segment in pages */ |
53 | unsigned int offset; /* start page of xpram segment */ | 52 | unsigned int offset; /* start page of xpram segment */ |
54 | unsigned int csum; /* partition checksum for suspend */ | ||
55 | } xpram_device_t; | 53 | } xpram_device_t; |
56 | 54 | ||
57 | static xpram_device_t xpram_devices[XPRAM_MAX_DEVS]; | 55 | static xpram_device_t xpram_devices[XPRAM_MAX_DEVS]; |
@@ -387,58 +385,6 @@ out: | |||
387 | } | 385 | } |
388 | 386 | ||
389 | /* | 387 | /* |
390 | * Save checksums for all partitions. | ||
391 | */ | ||
392 | static int xpram_save_checksums(void) | ||
393 | { | ||
394 | unsigned long mem_page; | ||
395 | int rc, i; | ||
396 | |||
397 | rc = 0; | ||
398 | mem_page = (unsigned long) __get_free_page(GFP_KERNEL); | ||
399 | if (!mem_page) | ||
400 | return -ENOMEM; | ||
401 | for (i = 0; i < xpram_devs; i++) { | ||
402 | rc = xpram_page_in(mem_page, xpram_devices[i].offset); | ||
403 | if (rc) | ||
404 | goto fail; | ||
405 | xpram_devices[i].csum = csum_partial((const void *) mem_page, | ||
406 | PAGE_SIZE, 0); | ||
407 | } | ||
408 | fail: | ||
409 | free_page(mem_page); | ||
410 | return rc ? -ENXIO : 0; | ||
411 | } | ||
412 | |||
413 | /* | ||
414 | * Verify checksums for all partitions. | ||
415 | */ | ||
416 | static int xpram_validate_checksums(void) | ||
417 | { | ||
418 | unsigned long mem_page; | ||
419 | unsigned int csum; | ||
420 | int rc, i; | ||
421 | |||
422 | rc = 0; | ||
423 | mem_page = (unsigned long) __get_free_page(GFP_KERNEL); | ||
424 | if (!mem_page) | ||
425 | return -ENOMEM; | ||
426 | for (i = 0; i < xpram_devs; i++) { | ||
427 | rc = xpram_page_in(mem_page, xpram_devices[i].offset); | ||
428 | if (rc) | ||
429 | goto fail; | ||
430 | csum = csum_partial((const void *) mem_page, PAGE_SIZE, 0); | ||
431 | if (xpram_devices[i].csum != csum) { | ||
432 | rc = -EINVAL; | ||
433 | goto fail; | ||
434 | } | ||
435 | } | ||
436 | fail: | ||
437 | free_page(mem_page); | ||
438 | return rc ? -ENXIO : 0; | ||
439 | } | ||
440 | |||
441 | /* | ||
442 | * Resume failed: Print error message and call panic. | 388 | * Resume failed: Print error message and call panic. |
443 | */ | 389 | */ |
444 | static void xpram_resume_error(const char *message) | 390 | static void xpram_resume_error(const char *message) |
@@ -458,21 +404,10 @@ static int xpram_restore(struct device *dev) | |||
458 | xpram_resume_error("xpram disappeared"); | 404 | xpram_resume_error("xpram disappeared"); |
459 | if (xpram_pages != xpram_highest_page_index() + 1) | 405 | if (xpram_pages != xpram_highest_page_index() + 1) |
460 | xpram_resume_error("Size of xpram changed"); | 406 | xpram_resume_error("Size of xpram changed"); |
461 | if (xpram_validate_checksums()) | ||
462 | xpram_resume_error("Data of xpram changed"); | ||
463 | return 0; | 407 | return 0; |
464 | } | 408 | } |
465 | 409 | ||
466 | /* | ||
467 | * Save necessary state in suspend. | ||
468 | */ | ||
469 | static int xpram_freeze(struct device *dev) | ||
470 | { | ||
471 | return xpram_save_checksums(); | ||
472 | } | ||
473 | |||
474 | static struct dev_pm_ops xpram_pm_ops = { | 410 | static struct dev_pm_ops xpram_pm_ops = { |
475 | .freeze = xpram_freeze, | ||
476 | .restore = xpram_restore, | 411 | .restore = xpram_restore, |
477 | }; | 412 | }; |
478 | 413 | ||