X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fchar%2Frtc.c;h=664f36c98e6acc4f257759aaff8c5586f48653e2;hb=refs%2Fheads%2Fvserver;hp=ab6429b4a84e424a9e390d3946bbd1ff6a8c316f;hpb=16c70f8c1b54b61c3b951b6fb220df250fe09b32;p=linux-2.6.git diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index ab6429b4a..664f36c98 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c @@ -35,13 +35,13 @@ * 1.09a Pete Zaitcev: Sun SPARC * 1.09b Jeff Garzik: Modularize, init cleanup * 1.09c Jeff Garzik: SMP cleanup - * 1.10 Paul Barton-Davis: add support for async I/O + * 1.10 Paul Barton-Davis: add support for async I/O * 1.10a Andrea Arcangeli: Alpha updates * 1.10b Andrew Morton: SMP lock fix * 1.10c Cesar Barros: SMP locking fixes and cleanup * 1.10d Paul Gortmaker: delete paranoia check in rtc_exit * 1.10e Maciej W. Rozycki: Handle DECstation's year weirdness. - * 1.11 Takashi Iwai: Kernel access functions + * 1.11 Takashi Iwai: Kernel access functions * rtc_register/rtc_unregister/rtc_control * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init * 1.12 Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer @@ -113,9 +113,14 @@ 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 -static inline irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs) {return 0;} +#ifdef RTC_IRQ +static irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id) +{ + return 0; +} +#endif #else -extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs); +extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id); #endif /* @@ -165,7 +170,9 @@ static void mask_rtc_irq_bit(unsigned char bit) } #endif +#ifdef CONFIG_PROC_FS static int rtc_proc_open(struct inode *inode, struct file *file); +#endif /* * Bits in rtc_status. (6 bits of room for future expansion) @@ -229,7 +236,7 @@ static inline unsigned char rtc_is_updating(void) * (See ./arch/XXXX/kernel/time.c for the set_rtc_mmss() function.) */ -irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs) +irqreturn_t rtc_interrupt(int irq, void *dev_id) { /* * Can be an alarm interrupt, update complete interrupt, @@ -906,6 +913,7 @@ static struct miscdevice rtc_dev = { .fops = &rtc_fops, }; +#ifdef CONFIG_PROC_FS static const struct file_operations rtc_proc_fops = { .owner = THIS_MODULE, .open = rtc_proc_open, @@ -913,14 +921,13 @@ static const struct file_operations rtc_proc_fops = { .llseek = seq_lseek, .release = single_release, }; - -#if defined(RTC_IRQ) && !defined(__sparc__) -static irqreturn_t (*rtc_int_handler_ptr)(int irq, void *dev_id, struct pt_regs *regs); #endif static int __init rtc_init(void) { +#ifdef CONFIG_PROC_FS struct proc_dir_entry *ent; +#endif #if defined(__alpha__) || defined(__mips__) unsigned int year, ctrl; char *guess = NULL; @@ -932,9 +939,11 @@ static int __init rtc_init(void) struct sparc_isa_bridge *isa_br; struct sparc_isa_device *isa_dev; #endif -#endif -#ifndef __sparc__ +#else void *r; +#ifdef RTC_IRQ + irq_handler_t rtc_int_handler_ptr; +#endif #endif #ifdef __sparc__ @@ -958,6 +967,7 @@ static int __init rtc_init(void) } } #endif + rtc_has_irq = 0; printk(KERN_ERR "rtc_init: no PC rtc found\n"); return -EIO; @@ -972,6 +982,7 @@ found: * PCI Slot 2 INTA# (and some INTx# in Slot 1). */ if (request_irq(rtc_irq, rtc_interrupt, IRQF_SHARED, "rtc", (void *)&rtc_port)) { + rtc_has_irq = 0; printk(KERN_ERR "rtc: cannot register IRQ %d\n", rtc_irq); return -EIO; } @@ -982,6 +993,9 @@ no_irq: else r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); if (!r) { +#ifdef RTC_IRQ + rtc_has_irq = 0; +#endif printk(KERN_ERR "rtc: I/O resource %lx is not free.\n", (long)(RTC_PORT(0))); return -EIO; @@ -996,6 +1010,7 @@ no_irq: if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) { /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ + rtc_has_irq = 0; printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); if (RTC_IOMAPPED) release_region(RTC_PORT(0), RTC_IO_EXTENT); @@ -1012,21 +1027,19 @@ no_irq: if (misc_register(&rtc_dev)) { #ifdef RTC_IRQ free_irq(RTC_IRQ, NULL); + rtc_has_irq = 0; #endif release_region(RTC_PORT(0), RTC_IO_EXTENT); return -ENODEV; } +#ifdef CONFIG_PROC_FS ent = create_proc_entry("driver/rtc", 0, NULL); - if (!ent) { -#ifdef RTC_IRQ - free_irq(RTC_IRQ, NULL); + if (ent) + ent->proc_fops = &rtc_proc_fops; + else + printk(KERN_WARNING "rtc: Failed to register with procfs.\n"); #endif - release_region(RTC_PORT(0), RTC_IO_EXTENT); - misc_deregister(&rtc_dev); - return -ENOMEM; - } - ent->proc_fops = &rtc_proc_fops; #if defined(__alpha__) || defined(__mips__) rtc_freq = HZ; @@ -1159,6 +1172,7 @@ static void rtc_dropped_irq(unsigned long data) } #endif +#ifdef CONFIG_PROC_FS /* * Info exported via "/proc/driver/rtc". */ @@ -1243,6 +1257,7 @@ static int rtc_proc_open(struct inode *inode, struct file *file) { return single_open(file, rtc_proc_show, NULL); } +#endif void rtc_get_rtc_time(struct rtc_time *rtc_tm) { @@ -1262,10 +1277,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) { - barrier(); + while (rtc_is_updating() != 0 && jiffies - uip_watchdog < 2*HZ/100) cpu_relax(); - } /* * Only the values that we read from the RTC are set. We leave