aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/sleep/proc.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-05-08 03:34:02 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:18 -0400
commitf5f72b46c349fefcfd4421b2213c6ffb324c5e56 (patch)
tree9ad2ac0eb4504399aad8f2a9a9e72ae8103e2e53 /drivers/acpi/sleep/proc.c
parent87ac84f42a7a580d0dd72ae31d6a5eb4bfe04c6d (diff)
ACPI wakeup hooks for rtc-cmos
Remove /proc/acpi/alarm file when the rtc-cmos "wakealarm" file is available. Instead, provide hooks that rtc-cmos will use. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Len Brown <lenb@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/acpi/sleep/proc.c')
-rw-r--r--drivers/acpi/sleep/proc.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c
index dcde9ddd105a..5a76e5be61d5 100644
--- a/drivers/acpi/sleep/proc.c
+++ b/drivers/acpi/sleep/proc.c
@@ -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
73static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) 81static 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,8 @@ 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 */
353
344 354
345extern struct list_head acpi_wakeup_device_list; 355extern struct list_head acpi_wakeup_device_list;
346extern spinlock_t acpi_device_lock; 356extern spinlock_t acpi_device_lock;
@@ -464,6 +474,7 @@ static const struct file_operations acpi_system_sleep_fops = {
464}; 474};
465#endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ 475#endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */
466 476
477#ifdef HAVE_ACPI_LEGACY_ALARM
467static const struct file_operations acpi_system_alarm_fops = { 478static const struct file_operations acpi_system_alarm_fops = {
468 .open = acpi_system_alarm_open_fs, 479 .open = acpi_system_alarm_open_fs,
469 .read = seq_read, 480 .read = seq_read,
@@ -479,8 +490,9 @@ static u32 rtc_handler(void *context)
479 490
480 return ACPI_INTERRUPT_HANDLED; 491 return ACPI_INTERRUPT_HANDLED;
481} 492}
493#endif /* HAVE_ACPI_LEGACY_ALARM */
482 494
483static int acpi_sleep_proc_init(void) 495static int __init acpi_sleep_proc_init(void)
484{ 496{
485 struct proc_dir_entry *entry = NULL; 497 struct proc_dir_entry *entry = NULL;
486 498
@@ -496,6 +508,7 @@ static int acpi_sleep_proc_init(void)
496 entry->proc_fops = &acpi_system_sleep_fops; 508 entry->proc_fops = &acpi_system_sleep_fops;
497#endif 509#endif
498 510
511#ifdef HAVE_ACPI_LEGACY_ALARM
499 /* 'alarm' [R/W] */ 512 /* 'alarm' [R/W] */
500 entry = 513 entry =
501 create_proc_entry("alarm", S_IFREG | S_IRUGO | S_IWUSR, 514 create_proc_entry("alarm", S_IFREG | S_IRUGO | S_IWUSR,
@@ -503,6 +516,9 @@ static int acpi_sleep_proc_init(void)
503 if (entry) 516 if (entry)
504 entry->proc_fops = &acpi_system_alarm_fops; 517 entry->proc_fops = &acpi_system_alarm_fops;
505 518
519 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL);
520#endif /* HAVE_ACPI_LEGACY_ALARM */
521
506 /* 'wakeup device' [R/W] */ 522 /* 'wakeup device' [R/W] */
507 entry = 523 entry =
508 create_proc_entry("wakeup", S_IFREG | S_IRUGO | S_IWUSR, 524 create_proc_entry("wakeup", S_IFREG | S_IRUGO | S_IWUSR,
@@ -510,7 +526,6 @@ static int acpi_sleep_proc_init(void)
510 if (entry) 526 if (entry)
511 entry->proc_fops = &acpi_system_wakeup_device_fops; 527 entry->proc_fops = &acpi_system_wakeup_device_fops;
512 528
513 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL);
514 return 0; 529 return 0;
515} 530}
516 531