]> err.no Git - linux-2.6/blobdiff - drivers/char/rtc.c
amiserial: Switch put char to return success/fail
[linux-2.6] / drivers / char / rtc.c
index 3ac7952fe086fd47da23dc733a88f1bacdab5204..5f80a9dff5735103b91cc16c40338aafa96f853a 100644 (file)
@@ -88,6 +88,7 @@
 
 #ifdef CONFIG_SPARC32
 #include <linux/pci.h>
+#include <linux/jiffies.h>
 #include <asm/ebus.h>
 
 static unsigned long rtc_port;
@@ -110,6 +111,8 @@ static int rtc_has_irq = 1;
 #define hpet_set_rtc_irq_bit(arg)              0
 #define hpet_rtc_timer_init()                  do { } while (0)
 #define hpet_rtc_dropped_irq()                 0
+#define hpet_register_irq_handler(h)           ({ 0; })
+#define hpet_unregister_irq_handler(h)         ({ 0; })
 #ifdef RTC_IRQ
 static irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
 {
@@ -1027,7 +1030,15 @@ no_irq:
 
 #ifdef RTC_IRQ
        if (is_hpet_enabled()) {
+               int err;
+
                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 {
                rtc_int_handler_ptr = rtc_interrupt;
        }
@@ -1050,6 +1061,7 @@ no_irq:
        if (misc_register(&rtc_dev)) {
 #ifdef RTC_IRQ
                free_irq(RTC_IRQ, NULL);
+               hpet_unregister_irq_handler(rtc_interrupt);
                rtc_has_irq = 0;
 #endif
                rtc_release_region();
@@ -1057,10 +1069,8 @@ no_irq:
        }
 
 #ifdef CONFIG_PROC_FS
-       ent = create_proc_entry("driver/rtc", 0, NULL);
-       if (ent)
-               ent->proc_fops = &rtc_proc_fops;
-       else
+       ent = proc_create("driver/rtc", 0, NULL, &rtc_proc_fops);
+       if (!ent)
                printk(KERN_WARNING "rtc: Failed to register with procfs.\n");
 #endif
 
@@ -1141,8 +1151,10 @@ static void __exit rtc_exit(void)
 #else
        rtc_release_region();
 #ifdef RTC_IRQ
-       if (rtc_has_irq)
+       if (rtc_has_irq) {
                free_irq(RTC_IRQ, NULL);
+               hpet_unregister_irq_handler(hpet_rtc_interrupt);
+       }
 #endif
 #endif /* CONFIG_SPARC32 */
 }
@@ -1303,7 +1315,8 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm)
         * Once the read clears, read the RTC time (again via ioctl). Easy.
         */
 
-       while (rtc_is_updating() != 0 && jiffies - uip_watchdog < 2*HZ/100)
+       while (rtc_is_updating() != 0 &&
+              time_before(jiffies, uip_watchdog + 2*HZ/100))
                cpu_relax();
 
        /*