diff options
Diffstat (limited to 'kernel/power/suspend_test.c')
| -rw-r--r-- | kernel/power/suspend_test.c | 35 | 
1 files changed, 16 insertions, 19 deletions
diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c index 25596e450ac..269b097e78e 100644 --- a/kernel/power/suspend_test.c +++ b/kernel/power/suspend_test.c @@ -92,13 +92,13 @@ static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state)  	}  	if (state == PM_SUSPEND_MEM) { -		printk(info_test, pm_states[state]); +		printk(info_test, pm_states[state].label);  		status = pm_suspend(state);  		if (status == -ENODEV)  			state = PM_SUSPEND_STANDBY;  	}  	if (state == PM_SUSPEND_STANDBY) { -		printk(info_test, pm_states[state]); +		printk(info_test, pm_states[state].label);  		status = pm_suspend(state);  	}  	if (status < 0) @@ -112,7 +112,7 @@ static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state)  	rtc_set_alarm(rtc, &alm);  } -static int __init has_wakealarm(struct device *dev, void *name_ptr) +static int __init has_wakealarm(struct device *dev, const void *data)  {  	struct rtc_device *candidate = to_rtc_device(dev); @@ -121,7 +121,6 @@ static int __init has_wakealarm(struct device *dev, void *name_ptr)  	if (!device_may_wakeup(candidate->dev.parent))  		return 0; -	*(const char **)name_ptr = dev_name(dev);  	return 1;  } @@ -137,18 +136,16 @@ static char warn_bad_state[] __initdata =  static int __init setup_test_suspend(char *value)  { -	unsigned i; +	suspend_state_t i;  	/* "=mem" ==> "mem" */  	value++; -	for (i = 0; i < PM_SUSPEND_MAX; i++) { -		if (!pm_states[i]) -			continue; -		if (strcmp(pm_states[i], value) != 0) -			continue; -		test_state = (__force suspend_state_t) i; -		return 0; -	} +	for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++) +		if (!strcmp(pm_states[i].label, value)) { +			test_state = pm_states[i].state; +			return 0; +		} +  	printk(warn_bad_state, value);  	return 0;  } @@ -159,21 +156,21 @@ static int __init test_suspend(void)  	static char		warn_no_rtc[] __initdata =  		KERN_WARNING "PM: no wakealarm-capable RTC driver is ready\n"; -	char			*pony = NULL;  	struct rtc_device	*rtc = NULL; +	struct device		*dev;  	/* PM is initialized by now; is that state testable? */  	if (test_state == PM_SUSPEND_ON)  		goto done; -	if (!valid_state(test_state)) { -		printk(warn_bad_state, pm_states[test_state]); +	if (!pm_states[test_state].state) { +		printk(warn_bad_state, pm_states[test_state].label);  		goto done;  	}  	/* RTCs have initialized by now too ... can we use one? */ -	class_find_device(rtc_class, NULL, &pony, has_wakealarm); -	if (pony) -		rtc = rtc_class_open(pony); +	dev = class_find_device(rtc_class, NULL, NULL, has_wakealarm); +	if (dev) +		rtc = rtc_class_open(dev_name(dev));  	if (!rtc) {  		printk(warn_no_rtc);  		goto done;  | 
