Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 157463
b: refs/heads/master
c: 99b5e2d
h: refs/heads/master
i:
  157461: e31f22d
  157459: 425df57
  157455: 4f3ba58
v: v3
  • Loading branch information
Michael Holzheu authored and Martin Schwidefsky committed Sep 11, 2009
1 parent b1331ec commit ef20111
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 66 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3f7cb51fac60618aa543058a90e668956d5fb518
refs/heads/master: 99b5e2d3d7ae8f5a2dba7a41a02ba7eb25523b3f
65 changes: 0 additions & 65 deletions trunk/drivers/s390/block/xpram.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include <linux/suspend.h>
#include <linux/platform_device.h>
#include <asm/uaccess.h>
#include <asm/checksum.h>

#define XPRAM_NAME "xpram"
#define XPRAM_DEVS 1 /* one partition */
Expand All @@ -51,7 +50,6 @@
typedef struct {
unsigned int size; /* size of xpram segment in pages */
unsigned int offset; /* start page of xpram segment */
unsigned int csum; /* partition checksum for suspend */
} xpram_device_t;

static xpram_device_t xpram_devices[XPRAM_MAX_DEVS];
Expand Down Expand Up @@ -386,58 +384,6 @@ static int __init xpram_setup_blkdev(void)
return rc;
}

/*
* Save checksums for all partitions.
*/
static int xpram_save_checksums(void)
{
unsigned long mem_page;
int rc, i;

rc = 0;
mem_page = (unsigned long) __get_free_page(GFP_KERNEL);
if (!mem_page)
return -ENOMEM;
for (i = 0; i < xpram_devs; i++) {
rc = xpram_page_in(mem_page, xpram_devices[i].offset);
if (rc)
goto fail;
xpram_devices[i].csum = csum_partial((const void *) mem_page,
PAGE_SIZE, 0);
}
fail:
free_page(mem_page);
return rc ? -ENXIO : 0;
}

/*
* Verify checksums for all partitions.
*/
static int xpram_validate_checksums(void)
{
unsigned long mem_page;
unsigned int csum;
int rc, i;

rc = 0;
mem_page = (unsigned long) __get_free_page(GFP_KERNEL);
if (!mem_page)
return -ENOMEM;
for (i = 0; i < xpram_devs; i++) {
rc = xpram_page_in(mem_page, xpram_devices[i].offset);
if (rc)
goto fail;
csum = csum_partial((const void *) mem_page, PAGE_SIZE, 0);
if (xpram_devices[i].csum != csum) {
rc = -EINVAL;
goto fail;
}
}
fail:
free_page(mem_page);
return rc ? -ENXIO : 0;
}

/*
* Resume failed: Print error message and call panic.
*/
Expand All @@ -458,21 +404,10 @@ static int xpram_restore(struct device *dev)
xpram_resume_error("xpram disappeared");
if (xpram_pages != xpram_highest_page_index() + 1)
xpram_resume_error("Size of xpram changed");
if (xpram_validate_checksums())
xpram_resume_error("Data of xpram changed");
return 0;
}

/*
* Save necessary state in suspend.
*/
static int xpram_freeze(struct device *dev)
{
return xpram_save_checksums();
}

static struct dev_pm_ops xpram_pm_ops = {
.freeze = xpram_freeze,
.restore = xpram_restore,
};

Expand Down

0 comments on commit ef20111

Please sign in to comment.