aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/rtc.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2007-02-10 01:26:32 -0500
committerDmitry Torokhov <dtor@insightbb.com>2007-02-10 01:26:32 -0500
commitb22364c8eec89e6b0c081a237f3b6348df87796f (patch)
tree233a923281fb640106465d076997ff511efb6edf /drivers/char/rtc.c
parent2c8dc071517ec2843869024dc82be2e246f41064 (diff)
parent66efc5a7e3061c3597ac43a8bb1026488d57e66b (diff)
Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/char/rtc.c')
-rw-r--r--drivers/char/rtc.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 66a7385bc34a..664f36c98e6a 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -113,7 +113,12 @@ static int rtc_has_irq = 1;
113#define hpet_set_rtc_irq_bit(arg) 0 113#define hpet_set_rtc_irq_bit(arg) 0
114#define hpet_rtc_timer_init() do { } while (0) 114#define hpet_rtc_timer_init() do { } while (0)
115#define hpet_rtc_dropped_irq() 0 115#define hpet_rtc_dropped_irq() 0
116static inline irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id) {return 0;} 116#ifdef RTC_IRQ
117static irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
118{
119 return 0;
120}
121#endif
117#else 122#else
118extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id); 123extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id);
119#endif 124#endif
@@ -165,7 +170,9 @@ static void mask_rtc_irq_bit(unsigned char bit)
165} 170}
166#endif 171#endif
167 172
173#ifdef CONFIG_PROC_FS
168static int rtc_proc_open(struct inode *inode, struct file *file); 174static int rtc_proc_open(struct inode *inode, struct file *file);
175#endif
169 176
170/* 177/*
171 * Bits in rtc_status. (6 bits of room for future expansion) 178 * Bits in rtc_status. (6 bits of room for future expansion)
@@ -906,6 +913,7 @@ static struct miscdevice rtc_dev = {
906 .fops = &rtc_fops, 913 .fops = &rtc_fops,
907}; 914};
908 915
916#ifdef CONFIG_PROC_FS
909static const struct file_operations rtc_proc_fops = { 917static const struct file_operations rtc_proc_fops = {
910 .owner = THIS_MODULE, 918 .owner = THIS_MODULE,
911 .open = rtc_proc_open, 919 .open = rtc_proc_open,
@@ -913,14 +921,13 @@ static const struct file_operations rtc_proc_fops = {
913 .llseek = seq_lseek, 921 .llseek = seq_lseek,
914 .release = single_release, 922 .release = single_release,
915}; 923};
916
917#if defined(RTC_IRQ) && !defined(__sparc__)
918static irq_handler_t rtc_int_handler_ptr;
919#endif 924#endif
920 925
921static int __init rtc_init(void) 926static int __init rtc_init(void)
922{ 927{
928#ifdef CONFIG_PROC_FS
923 struct proc_dir_entry *ent; 929 struct proc_dir_entry *ent;
930#endif
924#if defined(__alpha__) || defined(__mips__) 931#if defined(__alpha__) || defined(__mips__)
925 unsigned int year, ctrl; 932 unsigned int year, ctrl;
926 char *guess = NULL; 933 char *guess = NULL;
@@ -932,9 +939,11 @@ static int __init rtc_init(void)
932 struct sparc_isa_bridge *isa_br; 939 struct sparc_isa_bridge *isa_br;
933 struct sparc_isa_device *isa_dev; 940 struct sparc_isa_device *isa_dev;
934#endif 941#endif
935#endif 942#else
936#ifndef __sparc__
937 void *r; 943 void *r;
944#ifdef RTC_IRQ
945 irq_handler_t rtc_int_handler_ptr;
946#endif
938#endif 947#endif
939 948
940#ifdef __sparc__ 949#ifdef __sparc__
@@ -958,6 +967,7 @@ static int __init rtc_init(void)
958 } 967 }
959 } 968 }
960#endif 969#endif
970 rtc_has_irq = 0;
961 printk(KERN_ERR "rtc_init: no PC rtc found\n"); 971 printk(KERN_ERR "rtc_init: no PC rtc found\n");
962 return -EIO; 972 return -EIO;
963 973
@@ -972,6 +982,7 @@ found:
972 * PCI Slot 2 INTA# (and some INTx# in Slot 1). 982 * PCI Slot 2 INTA# (and some INTx# in Slot 1).
973 */ 983 */
974 if (request_irq(rtc_irq, rtc_interrupt, IRQF_SHARED, "rtc", (void *)&rtc_port)) { 984 if (request_irq(rtc_irq, rtc_interrupt, IRQF_SHARED, "rtc", (void *)&rtc_port)) {
985 rtc_has_irq = 0;
975 printk(KERN_ERR "rtc: cannot register IRQ %d\n", rtc_irq); 986 printk(KERN_ERR "rtc: cannot register IRQ %d\n", rtc_irq);
976 return -EIO; 987 return -EIO;
977 } 988 }
@@ -982,6 +993,9 @@ no_irq:
982 else 993 else
983 r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); 994 r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc");
984 if (!r) { 995 if (!r) {
996#ifdef RTC_IRQ
997 rtc_has_irq = 0;
998#endif
985 printk(KERN_ERR "rtc: I/O resource %lx is not free.\n", 999 printk(KERN_ERR "rtc: I/O resource %lx is not free.\n",
986 (long)(RTC_PORT(0))); 1000 (long)(RTC_PORT(0)));
987 return -EIO; 1001 return -EIO;
@@ -996,6 +1010,7 @@ no_irq:
996 1010
997 if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) { 1011 if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) {
998 /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ 1012 /* Yeah right, seeing as irq 8 doesn't even hit the bus. */
1013 rtc_has_irq = 0;
999 printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); 1014 printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ);
1000 if (RTC_IOMAPPED) 1015 if (RTC_IOMAPPED)
1001 release_region(RTC_PORT(0), RTC_IO_EXTENT); 1016 release_region(RTC_PORT(0), RTC_IO_EXTENT);
@@ -1012,21 +1027,19 @@ no_irq:
1012 if (misc_register(&rtc_dev)) { 1027 if (misc_register(&rtc_dev)) {
1013#ifdef RTC_IRQ 1028#ifdef RTC_IRQ
1014 free_irq(RTC_IRQ, NULL); 1029 free_irq(RTC_IRQ, NULL);
1030 rtc_has_irq = 0;
1015#endif 1031#endif
1016 release_region(RTC_PORT(0), RTC_IO_EXTENT); 1032 release_region(RTC_PORT(0), RTC_IO_EXTENT);
1017 return -ENODEV; 1033 return -ENODEV;
1018 } 1034 }
1019 1035
1036#ifdef CONFIG_PROC_FS
1020 ent = create_proc_entry("driver/rtc", 0, NULL); 1037 ent = create_proc_entry("driver/rtc", 0, NULL);
1021 if (!ent) { 1038 if (ent)
1022#ifdef RTC_IRQ 1039 ent->proc_fops = &rtc_proc_fops;
1023 free_irq(RTC_IRQ, NULL); 1040 else
1041 printk(KERN_WARNING "rtc: Failed to register with procfs.\n");
1024#endif 1042#endif
1025 release_region(RTC_PORT(0), RTC_IO_EXTENT);
1026 misc_deregister(&rtc_dev);
1027 return -ENOMEM;
1028 }
1029 ent->proc_fops = &rtc_proc_fops;
1030 1043
1031#if defined(__alpha__) || defined(__mips__) 1044#if defined(__alpha__) || defined(__mips__)
1032 rtc_freq = HZ; 1045 rtc_freq = HZ;
@@ -1159,6 +1172,7 @@ static void rtc_dropped_irq(unsigned long data)
1159} 1172}
1160#endif 1173#endif
1161 1174
1175#ifdef CONFIG_PROC_FS
1162/* 1176/*
1163 * Info exported via "/proc/driver/rtc". 1177 * Info exported via "/proc/driver/rtc".
1164 */ 1178 */
@@ -1243,6 +1257,7 @@ static int rtc_proc_open(struct inode *inode, struct file *file)
1243{ 1257{
1244 return single_open(file, rtc_proc_show, NULL); 1258 return single_open(file, rtc_proc_show, NULL);
1245} 1259}
1260#endif
1246 1261
1247void rtc_get_rtc_time(struct rtc_time *rtc_tm) 1262void rtc_get_rtc_time(struct rtc_time *rtc_tm)
1248{ 1263{