diff options
Diffstat (limited to 'drivers/acpi/sleep/proc.c')
-rw-r--r-- | drivers/acpi/sleep/proc.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c index dcde9ddd105a..61f1822cc350 100644 --- a/drivers/acpi/sleep/proc.c +++ b/drivers/acpi/sleep/proc.c | |||
@@ -60,7 +60,7 @@ acpi_system_write_sleep(struct file *file, | |||
60 | state = simple_strtoul(str, NULL, 0); | 60 | state = simple_strtoul(str, NULL, 0); |
61 | #ifdef CONFIG_SOFTWARE_SUSPEND | 61 | #ifdef CONFIG_SOFTWARE_SUSPEND |
62 | if (state == 4) { | 62 | if (state == 4) { |
63 | error = pm_suspend(PM_SUSPEND_DISK); | 63 | error = hibernate(); |
64 | goto Done; | 64 | goto Done; |
65 | } | 65 | } |
66 | #endif | 66 | #endif |
@@ -70,6 +70,14 @@ acpi_system_write_sleep(struct file *file, | |||
70 | } | 70 | } |
71 | #endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ | 71 | #endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ |
72 | 72 | ||
73 | #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) | ||
74 | /* use /sys/class/rtc/rtcX/wakealarm instead; it's not ACPI-specific */ | ||
75 | #else | ||
76 | #define HAVE_ACPI_LEGACY_ALARM | ||
77 | #endif | ||
78 | |||
79 | #ifdef HAVE_ACPI_LEGACY_ALARM | ||
80 | |||
73 | static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) | 81 | static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) |
74 | { | 82 | { |
75 | u32 sec, min, hr; | 83 | u32 sec, min, hr; |
@@ -341,6 +349,7 @@ acpi_system_write_alarm(struct file *file, | |||
341 | end: | 349 | end: |
342 | return_VALUE(result ? result : count); | 350 | return_VALUE(result ? result : count); |
343 | } | 351 | } |
352 | #endif /* HAVE_ACPI_LEGACY_ALARM */ | ||
344 | 353 | ||
345 | extern struct list_head acpi_wakeup_device_list; | 354 | extern struct list_head acpi_wakeup_device_list; |
346 | extern spinlock_t acpi_device_lock; | 355 | extern spinlock_t acpi_device_lock; |
@@ -370,8 +379,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
370 | dev->wakeup.state.enabled ? "enabled" : "disabled"); | 379 | dev->wakeup.state.enabled ? "enabled" : "disabled"); |
371 | if (ldev) | 380 | if (ldev) |
372 | seq_printf(seq, "%s:%s", | 381 | seq_printf(seq, "%s:%s", |
373 | ldev->bus ? ldev->bus->name : "no-bus", | 382 | ldev->bus ? ldev->bus->name : "no-bus", |
374 | ldev->bus_id); | 383 | ldev->bus_id); |
375 | seq_printf(seq, "\n"); | 384 | seq_printf(seq, "\n"); |
376 | put_device(ldev); | 385 | put_device(ldev); |
377 | 386 | ||
@@ -464,6 +473,7 @@ static const struct file_operations acpi_system_sleep_fops = { | |||
464 | }; | 473 | }; |
465 | #endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ | 474 | #endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ |
466 | 475 | ||
476 | #ifdef HAVE_ACPI_LEGACY_ALARM | ||
467 | static const struct file_operations acpi_system_alarm_fops = { | 477 | static const struct file_operations acpi_system_alarm_fops = { |
468 | .open = acpi_system_alarm_open_fs, | 478 | .open = acpi_system_alarm_open_fs, |
469 | .read = seq_read, | 479 | .read = seq_read, |
@@ -479,8 +489,9 @@ static u32 rtc_handler(void *context) | |||
479 | 489 | ||
480 | return ACPI_INTERRUPT_HANDLED; | 490 | return ACPI_INTERRUPT_HANDLED; |
481 | } | 491 | } |
492 | #endif /* HAVE_ACPI_LEGACY_ALARM */ | ||
482 | 493 | ||
483 | static int acpi_sleep_proc_init(void) | 494 | static int __init acpi_sleep_proc_init(void) |
484 | { | 495 | { |
485 | struct proc_dir_entry *entry = NULL; | 496 | struct proc_dir_entry *entry = NULL; |
486 | 497 | ||
@@ -496,6 +507,7 @@ static int acpi_sleep_proc_init(void) | |||
496 | entry->proc_fops = &acpi_system_sleep_fops; | 507 | entry->proc_fops = &acpi_system_sleep_fops; |
497 | #endif | 508 | #endif |
498 | 509 | ||
510 | #ifdef HAVE_ACPI_LEGACY_ALARM | ||
499 | /* 'alarm' [R/W] */ | 511 | /* 'alarm' [R/W] */ |
500 | entry = | 512 | entry = |
501 | create_proc_entry("alarm", S_IFREG | S_IRUGO | S_IWUSR, | 513 | create_proc_entry("alarm", S_IFREG | S_IRUGO | S_IWUSR, |
@@ -503,6 +515,9 @@ static int acpi_sleep_proc_init(void) | |||
503 | if (entry) | 515 | if (entry) |
504 | entry->proc_fops = &acpi_system_alarm_fops; | 516 | entry->proc_fops = &acpi_system_alarm_fops; |
505 | 517 | ||
518 | acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); | ||
519 | #endif /* HAVE_ACPI_LEGACY_ALARM */ | ||
520 | |||
506 | /* 'wakeup device' [R/W] */ | 521 | /* 'wakeup device' [R/W] */ |
507 | entry = | 522 | entry = |
508 | create_proc_entry("wakeup", S_IFREG | S_IRUGO | S_IWUSR, | 523 | create_proc_entry("wakeup", S_IFREG | S_IRUGO | S_IWUSR, |
@@ -510,7 +525,6 @@ static int acpi_sleep_proc_init(void) | |||
510 | if (entry) | 525 | if (entry) |
511 | entry->proc_fops = &acpi_system_wakeup_device_fops; | 526 | entry->proc_fops = &acpi_system_wakeup_device_fops; |
512 | 527 | ||
513 | acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); | ||
514 | return 0; | 528 | return 0; |
515 | } | 529 | } |
516 | 530 | ||