diff options
author | Bernhard Walle <bwalle@suse.de> | 2008-01-30 07:33:31 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:33:31 -0500 |
commit | f8f76481bc2803aea03ff213c7e1405b53f7e488 (patch) | |
tree | 5356ad1b63ed7b2e36c57102bbac3a1ce44427b9 | |
parent | 1bdbdaacf774f2979ed4cb0c4a4316c9e578c897 (diff) |
rtc: use the IRQ callback interface in (old) RTC driver
the previous patch in the old RTC driver. It also removes the direct
rtc_interrupt() call from arch/x86/kernel/hpetc.c so that there's finally no
(code) dependency to CONFIG_RTC in arch/x86/kernel/hpet.c.
Because of this, it's possible to compile the drivers/char/rtc.ko driver as
module and still use the HPET emulation functionality. This is also expressed
in Kconfig.
Signed-off-by: Bernhard Walle <bwalle@suse.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: David Brownell <david-b@pacbell.net>
Cc: Andi Kleen <ak@suse.de>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Robert Picco <Robert.Picco@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/Kconfig | 2 | ||||
-rw-r--r-- | arch/x86/kernel/hpet.c | 2 | ||||
-rw-r--r-- | drivers/char/rtc.c | 15 |
3 files changed, 15 insertions, 4 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 81af31e5a9f1..4e911d0a4962 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -390,7 +390,7 @@ config HPET_TIMER | |||
390 | 390 | ||
391 | config HPET_EMULATE_RTC | 391 | config HPET_EMULATE_RTC |
392 | def_bool y | 392 | def_bool y |
393 | depends on HPET_TIMER && RTC=y | 393 | depends on HPET_TIMER && (RTC=y || RTC=m) |
394 | 394 | ||
395 | # Mark as embedded because too many people got it wrong. | 395 | # Mark as embedded because too many people got it wrong. |
396 | # The code disables itself when not needed. | 396 | # The code disables itself when not needed. |
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index d65ced59a18f..429d084e014d 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
@@ -705,8 +705,6 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id) | |||
705 | rtc_int_flag |= (RTC_IRQF | (RTC_NUM_INTS << 8)); | 705 | rtc_int_flag |= (RTC_IRQF | (RTC_NUM_INTS << 8)); |
706 | if (irq_handler) | 706 | if (irq_handler) |
707 | irq_handler(rtc_int_flag, dev_id); | 707 | irq_handler(rtc_int_flag, dev_id); |
708 | |||
709 | rtc_interrupt(rtc_int_flag, dev_id); | ||
710 | } | 708 | } |
711 | return IRQ_HANDLED; | 709 | return IRQ_HANDLED; |
712 | } | 710 | } |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 3ac7952fe086..78b151c4d20f 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -110,6 +110,8 @@ static int rtc_has_irq = 1; | |||
110 | #define hpet_set_rtc_irq_bit(arg) 0 | 110 | #define hpet_set_rtc_irq_bit(arg) 0 |
111 | #define hpet_rtc_timer_init() do { } while (0) | 111 | #define hpet_rtc_timer_init() do { } while (0) |
112 | #define hpet_rtc_dropped_irq() 0 | 112 | #define hpet_rtc_dropped_irq() 0 |
113 | #define hpet_register_irq_handler(h) 0 | ||
114 | #define hpet_unregister_irq_handler(h) 0 | ||
113 | #ifdef RTC_IRQ | 115 | #ifdef RTC_IRQ |
114 | static irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id) | 116 | static irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id) |
115 | { | 117 | { |
@@ -1027,7 +1029,15 @@ no_irq: | |||
1027 | 1029 | ||
1028 | #ifdef RTC_IRQ | 1030 | #ifdef RTC_IRQ |
1029 | if (is_hpet_enabled()) { | 1031 | if (is_hpet_enabled()) { |
1032 | int err; | ||
1033 | |||
1030 | rtc_int_handler_ptr = hpet_rtc_interrupt; | 1034 | rtc_int_handler_ptr = hpet_rtc_interrupt; |
1035 | err = hpet_register_irq_handler(rtc_interrupt); | ||
1036 | if (err != 0) { | ||
1037 | printk(KERN_WARNING "hpet_register_irq_handler failed " | ||
1038 | "in rtc_init()."); | ||
1039 | return err; | ||
1040 | } | ||
1031 | } else { | 1041 | } else { |
1032 | rtc_int_handler_ptr = rtc_interrupt; | 1042 | rtc_int_handler_ptr = rtc_interrupt; |
1033 | } | 1043 | } |
@@ -1050,6 +1060,7 @@ no_irq: | |||
1050 | if (misc_register(&rtc_dev)) { | 1060 | if (misc_register(&rtc_dev)) { |
1051 | #ifdef RTC_IRQ | 1061 | #ifdef RTC_IRQ |
1052 | free_irq(RTC_IRQ, NULL); | 1062 | free_irq(RTC_IRQ, NULL); |
1063 | hpet_unregister_irq_handler(rtc_interrupt); | ||
1053 | rtc_has_irq = 0; | 1064 | rtc_has_irq = 0; |
1054 | #endif | 1065 | #endif |
1055 | rtc_release_region(); | 1066 | rtc_release_region(); |
@@ -1141,8 +1152,10 @@ static void __exit rtc_exit(void) | |||
1141 | #else | 1152 | #else |
1142 | rtc_release_region(); | 1153 | rtc_release_region(); |
1143 | #ifdef RTC_IRQ | 1154 | #ifdef RTC_IRQ |
1144 | if (rtc_has_irq) | 1155 | if (rtc_has_irq) { |
1145 | free_irq(RTC_IRQ, NULL); | 1156 | free_irq(RTC_IRQ, NULL); |
1157 | hpet_unregister_irq_handler(hpet_rtc_interrupt); | ||
1158 | } | ||
1146 | #endif | 1159 | #endif |
1147 | #endif /* CONFIG_SPARC32 */ | 1160 | #endif /* CONFIG_SPARC32 */ |
1148 | } | 1161 | } |