Commit f8f76481 authored by Bernhard Walle's avatar Bernhard Walle Committed by Ingo Molnar

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: default avatarBernhard 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 1bdbdaac
...@@ -390,7 +390,7 @@ config HPET_TIMER ...@@ -390,7 +390,7 @@ config HPET_TIMER
config HPET_EMULATE_RTC config HPET_EMULATE_RTC
def_bool y def_bool y
depends on HPET_TIMER && RTC=y depends on HPET_TIMER && (RTC=y || RTC=m)
# Mark as embedded because too many people got it wrong. # Mark as embedded because too many people got it wrong.
# The code disables itself when not needed. # The code disables itself when not needed.
......
...@@ -705,8 +705,6 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id) ...@@ -705,8 +705,6 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
rtc_int_flag |= (RTC_IRQF | (RTC_NUM_INTS << 8)); rtc_int_flag |= (RTC_IRQF | (RTC_NUM_INTS << 8));
if (irq_handler) if (irq_handler)
irq_handler(rtc_int_flag, dev_id); irq_handler(rtc_int_flag, dev_id);
rtc_interrupt(rtc_int_flag, dev_id);
} }
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -110,6 +110,8 @@ static int rtc_has_irq = 1; ...@@ -110,6 +110,8 @@ static int rtc_has_irq = 1;
#define hpet_set_rtc_irq_bit(arg) 0 #define hpet_set_rtc_irq_bit(arg) 0
#define hpet_rtc_timer_init() do { } while (0) #define hpet_rtc_timer_init() do { } while (0)
#define hpet_rtc_dropped_irq() 0 #define hpet_rtc_dropped_irq() 0
#define hpet_register_irq_handler(h) 0
#define hpet_unregister_irq_handler(h) 0
#ifdef RTC_IRQ #ifdef RTC_IRQ
static irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id) static irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
{ {
...@@ -1027,7 +1029,15 @@ no_irq: ...@@ -1027,7 +1029,15 @@ no_irq:
#ifdef RTC_IRQ #ifdef RTC_IRQ
if (is_hpet_enabled()) { if (is_hpet_enabled()) {
int err;
rtc_int_handler_ptr = hpet_rtc_interrupt; rtc_int_handler_ptr = hpet_rtc_interrupt;
err = hpet_register_irq_handler(rtc_interrupt);
if (err != 0) {
printk(KERN_WARNING "hpet_register_irq_handler failed "
"in rtc_init().");
return err;
}
} else { } else {
rtc_int_handler_ptr = rtc_interrupt; rtc_int_handler_ptr = rtc_interrupt;
} }
...@@ -1050,6 +1060,7 @@ no_irq: ...@@ -1050,6 +1060,7 @@ no_irq:
if (misc_register(&rtc_dev)) { if (misc_register(&rtc_dev)) {
#ifdef RTC_IRQ #ifdef RTC_IRQ
free_irq(RTC_IRQ, NULL); free_irq(RTC_IRQ, NULL);
hpet_unregister_irq_handler(rtc_interrupt);
rtc_has_irq = 0; rtc_has_irq = 0;
#endif #endif
rtc_release_region(); rtc_release_region();
...@@ -1141,8 +1152,10 @@ static void __exit rtc_exit(void) ...@@ -1141,8 +1152,10 @@ static void __exit rtc_exit(void)
#else #else
rtc_release_region(); rtc_release_region();
#ifdef RTC_IRQ #ifdef RTC_IRQ
if (rtc_has_irq) if (rtc_has_irq) {
free_irq(RTC_IRQ, NULL); free_irq(RTC_IRQ, NULL);
hpet_unregister_irq_handler(hpet_rtc_interrupt);
}
#endif #endif
#endif /* CONFIG_SPARC32 */ #endif /* CONFIG_SPARC32 */
} }
......
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