Skip to content

Commit

Permalink
remove software_suspend()
Browse files Browse the repository at this point in the history
Remove software_suspend() and all its users since
pm_suspend(PM_SUSPEND_DISK) should be equivalent and there's no point in
having two interfaces for the same thing.

The patch also changes the valid_state function to return 0 (false) for
PM_SUSPEND_DISK when SOFTWARE_SUSPEND is not configured instead of
accepting it and having the whole thing fail later.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Johannes Berg authored and Linus Torvalds committed May 7, 2007
1 parent b1296cc commit ab3bfca
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 26 deletions.
2 changes: 1 addition & 1 deletion drivers/acpi/sleep/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ acpi_system_write_sleep(struct file *file,
state = simple_strtoul(str, NULL, 0);
#ifdef CONFIG_SOFTWARE_SUSPEND
if (state == 4) {
error = software_suspend();
error = pm_suspend(PM_SUSPEND_DISK);
goto Done;
}
#endif
Expand Down
4 changes: 3 additions & 1 deletion drivers/i2c/chips/tps65010.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,10 @@ static void tps65010_interrupt(struct tps65010 *tps)
#if 0
/* REVISIT: this might need its own workqueue
* plus tweaks including deadlock avoidance ...
* also needs to get error handling and probably
* an #ifdef CONFIG_SOFTWARE_SUSPEND
*/
software_suspend();
pm_suspend(PM_SUSPEND_DISK);
#endif
poll = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion include/linux/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ void __init parse_early_param(void);
#define __obsolete_setup(str) /* nothing */
#endif

/* Data marked not to be saved by software_suspend() */
/* Data marked not to be saved by software suspend */
#define __nosavedata __attribute__ ((__section__ (".data.nosave")))

/* This means "can be init if no module support, otherwise module load
Expand Down
8 changes: 0 additions & 8 deletions include/linux/suspend.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,13 @@ static inline void pm_restore_console(void) {}
#endif

#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
/* kernel/power/swsusp.c */
extern int software_suspend(void);
/* kernel/power/snapshot.c */
extern void __init register_nosave_region(unsigned long, unsigned long);
extern int swsusp_page_is_forbidden(struct page *);
extern void swsusp_set_page_free(struct page *);
extern void swsusp_unset_page_free(struct page *);
extern unsigned long get_safe_page(gfp_t gfp_mask);
#else
static inline int software_suspend(void)
{
printk("Warning: fake suspend called\n");
return -ENOSYS;
}

static inline void register_nosave_region(unsigned long b, unsigned long e) {}
static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
static inline void swsusp_set_page_free(struct page *p) {}
Expand Down
21 changes: 7 additions & 14 deletions kernel/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,17 +184,21 @@ static void suspend_finish(suspend_state_t state)
static const char * const pm_states[PM_SUSPEND_MAX] = {
[PM_SUSPEND_STANDBY] = "standby",
[PM_SUSPEND_MEM] = "mem",
#ifdef CONFIG_SOFTWARE_SUSPEND
[PM_SUSPEND_DISK] = "disk",
#endif
};

static inline int valid_state(suspend_state_t state)
{
/* Suspend-to-disk does not really need low-level support.
* It can work with reboot if needed. */
* It can work with shutdown/reboot if needed. If it isn't
* configured, then it cannot be supported.
*/
if (state == PM_SUSPEND_DISK)
#ifdef CONFIG_SOFTWARE_SUSPEND
return 1;
#else
return 0;
#endif

/* all other states need lowlevel support and need to be
* valid to the lowlevel implementation, no valid callback
Expand Down Expand Up @@ -244,17 +248,6 @@ static int enter_state(suspend_state_t state)
return error;
}

#ifdef CONFIG_SOFTWARE_SUSPEND
/*
* This is main interface to the outside world. It needs to be
* called from process context.
*/
int software_suspend(void)
{
return enter_state(PM_SUSPEND_DISK);
}
#endif


/**
* pm_suspend - Externally visible function for suspending system.
Expand Down
2 changes: 1 addition & 1 deletion kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void __user
#ifdef CONFIG_SOFTWARE_SUSPEND
case LINUX_REBOOT_CMD_SW_SUSPEND:
{
int ret = software_suspend();
int ret = pm_suspend(PM_SUSPEND_DISK);
unlock_kernel();
return ret;
}
Expand Down

0 comments on commit ab3bfca

Please sign in to comment.