Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23025
b: refs/heads/master
c: 9b23820
h: refs/heads/master
i:
  23023: a946e18
v: v3
  • Loading branch information
Luca Tettamanti authored and Linus Torvalds committed Mar 23, 2006
1 parent 1a9c9c5 commit cafc995
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 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: 94c188d32996beac00426740974310e32f162c14
refs/heads/master: 9b238205ba5d79a8a242d7a5ddb82b89e4dc4e48
2 changes: 1 addition & 1 deletion trunk/kernel/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static int suspend_prepare(suspend_state_t state)
}


static int suspend_enter(suspend_state_t state)
int suspend_enter(suspend_state_t state)
{
int error = 0;
unsigned long flags;
Expand Down
4 changes: 3 additions & 1 deletion trunk/kernel/power/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ int snapshot_image_loaded(struct snapshot_handle *handle);
#define SNAPSHOT_GET_SWAP_PAGE _IOR(SNAPSHOT_IOC_MAGIC, 8, void *)
#define SNAPSHOT_FREE_SWAP_PAGES _IO(SNAPSHOT_IOC_MAGIC, 9)
#define SNAPSHOT_SET_SWAP_FILE _IOW(SNAPSHOT_IOC_MAGIC, 10, unsigned int)
#define SNAPSHOT_IOC_MAXNR 10
#define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11)
#define SNAPSHOT_IOC_MAXNR 11

/**
* The bitmap is used for tracing allocated swap pages
Expand Down Expand Up @@ -112,3 +113,4 @@ extern int swsusp_resume(void);
extern int swsusp_read(void);
extern int swsusp_write(void);
extern void swsusp_close(void);
extern int suspend_enter(suspend_state_t state);
36 changes: 36 additions & 0 deletions trunk/kernel/power/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,42 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
}
break;

case SNAPSHOT_S2RAM:
if (!data->frozen) {
error = -EPERM;
break;
}

if (down_trylock(&pm_sem)) {
error = -EBUSY;
break;
}

if (pm_ops->prepare) {
error = pm_ops->prepare(PM_SUSPEND_MEM);
if (error)
goto OutS3;
}

/* Put devices to sleep */
error = device_suspend(PMSG_SUSPEND);
if (error) {
printk(KERN_ERR "Failed to suspend some devices.\n");
} else {
/* Enter S3, system is already frozen */
suspend_enter(PM_SUSPEND_MEM);

/* Wake up devices */
device_resume();
}

if (pm_ops->finish)
pm_ops->finish(PM_SUSPEND_MEM);

OutS3:
up(&pm_sem);
break;

default:
error = -ENOTTY;

Expand Down

0 comments on commit cafc995

Please sign in to comment.