Commit c1ec9cae authored by Pavel Machek's avatar Pavel Machek Committed by Linus Torvalds

[PATCH] Add typechecking to suspend types and powerdown types

This adds typechecking to suspend types and powerdown types.  This should
solve at least part of suspend type confusion.  There should be no code
changes generated by this one.
Acked-by: default avatarPatrick Mochel <mochel@digitalimplant.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 53b56386
......@@ -63,7 +63,7 @@ enum { SLEEP_SAVE_START = 0,
};
static int pxa_pm_enter(u32 state)
static int pxa_pm_enter(suspend_state_t state)
{
unsigned long sleep_save[SLEEP_SAVE_SIZE];
unsigned long checksum = 0;
......@@ -163,7 +163,7 @@ unsigned long sleep_phys_sp(void *sp)
/*
* Called after processes are frozen, but before we shut down devices.
*/
static int pxa_pm_prepare(u32 state)
static int pxa_pm_prepare(suspend_state_t state)
{
return 0;
}
......@@ -171,7 +171,7 @@ static int pxa_pm_prepare(u32 state)
/*
* Called after devices are re-setup, but before processes are thawed.
*/
static int pxa_pm_finish(u32 state)
static int pxa_pm_finish(suspend_state_t state)
{
return 0;
}
......
......@@ -54,7 +54,7 @@ enum { SLEEP_SAVE_SP = 0,
};
static int sa11x0_pm_enter(u32 state)
static int sa11x0_pm_enter(suspend_state_t state)
{
unsigned long gpio, sleep_save[SLEEP_SAVE_SIZE];
struct timespec delta, rtc;
......@@ -135,7 +135,7 @@ unsigned long sleep_phys_sp(void *sp)
/*
* Called after processes are frozen, but before we shut down devices.
*/
static int sa11x0_pm_prepare(u32 state)
static int sa11x0_pm_prepare(suspend_state_t state)
{
return 0;
}
......@@ -143,7 +143,7 @@ static int sa11x0_pm_prepare(u32 state)
/*
* Called after devices are re-setup, but before processes are thawed.
*/
static int sa11x0_pm_finish(u32 state)
static int sa11x0_pm_finish(suspend_state_t state)
{
return 0;
}
......
......@@ -42,7 +42,7 @@ static int init_8259A_after_S1;
* wakeup code to the waking vector.
*/
static int acpi_pm_prepare(u32 pm_state)
static int acpi_pm_prepare(suspend_state_t pm_state)
{
u32 acpi_state = acpi_suspend_states[pm_state];
......@@ -74,7 +74,7 @@ static int acpi_pm_prepare(u32 pm_state)
* It's unfortunate, but it works. Please fix if you're feeling frisky.
*/
static int acpi_pm_enter(u32 pm_state)
static int acpi_pm_enter(suspend_state_t pm_state)
{
acpi_status status = AE_OK;
unsigned long flags = 0;
......@@ -136,7 +136,7 @@ static int acpi_pm_enter(u32 pm_state)
* failed).
*/
static int acpi_pm_finish(u32 pm_state)
static int acpi_pm_finish(suspend_state_t pm_state)
{
u32 acpi_state = acpi_suspend_states[pm_state];
......
......@@ -188,34 +188,32 @@ static inline void pm_dev_idle(struct pm_dev *dev) {}
extern void (*pm_idle)(void);
extern void (*pm_power_off)(void);
enum {
PM_SUSPEND_ON = 0,
PM_SUSPEND_STANDBY = 1,
/* NOTE: PM_SUSPEND_MEM == PCI_D3hot */
PM_SUSPEND_MEM = 3,
PM_SUSPEND_DISK = 4,
PM_SUSPEND_MAX = 5,
};
typedef int __bitwise suspend_state_t;
enum {
PM_DISK_FIRMWARE = 1,
PM_DISK_PLATFORM,
PM_DISK_SHUTDOWN,
PM_DISK_REBOOT,
PM_DISK_MAX,
};
#define PM_SUSPEND_ON ((__force suspend_state_t) 0)
#define PM_SUSPEND_STANDBY ((__force suspend_state_t) 1)
#define PM_SUSPEND_MEM ((__force suspend_state_t) 3)
#define PM_SUSPEND_DISK ((__force suspend_state_t) 4)
#define PM_SUSPEND_MAX ((__force suspend_state_t) 5)
typedef int __bitwise suspend_disk_method_t;
#define PM_DISK_FIRMWARE ((__force suspend_disk_method_t) 1)
#define PM_DISK_PLATFORM ((__force suspend_disk_method_t) 2)
#define PM_DISK_SHUTDOWN ((__force suspend_disk_method_t) 3)
#define PM_DISK_REBOOT ((__force suspend_disk_method_t) 4)
#define PM_DISK_MAX ((__force suspend_disk_method_t) 5)
struct pm_ops {
u32 pm_disk_mode;
int (*prepare)(u32 state);
int (*enter)(u32 state);
int (*finish)(u32 state);
suspend_disk_method_t pm_disk_mode;
int (*prepare)(suspend_state_t state);
int (*enter)(suspend_state_t state);
int (*finish)(suspend_state_t state);
};
extern void pm_set_ops(struct pm_ops *);
extern int pm_suspend(u32 state);
extern int pm_suspend(suspend_state_t state);
/*
......
......@@ -16,10 +16,11 @@
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/device.h>
#include "power.h"
extern u32 pm_disk_mode;
extern suspend_disk_method_t pm_disk_mode;
extern struct pm_ops * pm_ops;
extern int swsusp_suspend(void);
......@@ -293,7 +294,7 @@ static ssize_t disk_store(struct subsystem * s, const char * buf, size_t n)
int i;
int len;
char *p;
u32 mode = 0;
suspend_disk_method_t mode = 0;
p = memchr(buf, '\n', n);
len = p ? p - buf : n;
......
......@@ -22,7 +22,7 @@
DECLARE_MUTEX(pm_sem);
struct pm_ops * pm_ops = NULL;
u32 pm_disk_mode = PM_DISK_SHUTDOWN;
suspend_disk_method_t pm_disk_mode = PM_DISK_SHUTDOWN;
/**
* pm_set_ops - Set the global power method table.
......@@ -46,7 +46,7 @@ void pm_set_ops(struct pm_ops * ops)
* the platform can enter the requested state.
*/
static int suspend_prepare(u32 state)
static int suspend_prepare(suspend_state_t state)
{
int error = 0;
......@@ -102,7 +102,7 @@ static int suspend_enter(u32 state)
* console that we've allocated.
*/
static void suspend_finish(u32 state)
static void suspend_finish(suspend_state_t state)
{
device_resume();
if (pm_ops && pm_ops->finish)
......@@ -133,7 +133,7 @@ char * pm_states[] = {
* we've woken up).
*/
static int enter_state(u32 state)
static int enter_state(suspend_state_t state)
{
int error;
......@@ -183,7 +183,7 @@ int software_suspend(void)
* structure, and enter (above).
*/
int pm_suspend(u32 state)
int pm_suspend(suspend_state_t state)
{
if (state > PM_SUSPEND_ON && state < PM_SUSPEND_MAX)
return enter_state(state);
......@@ -221,7 +221,7 @@ static ssize_t state_show(struct subsystem * subsys, char * buf)
static ssize_t state_store(struct subsystem * subsys, const char * buf, size_t n)
{
u32 state = PM_SUSPEND_STANDBY;
suspend_state_t state = PM_SUSPEND_STANDBY;
char ** s;
char *p;
int error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment