aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2006-12-13 03:35:05 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-13 12:05:52 -0500
commit9cef779ec3643e6c846f86a32d8c44daff16a336 (patch)
tree0f797b0e90876fe65f6cb6f7e7b8ec0d9dbf3efb
parentf3e92d355e1251fb6d1a15508f2a5448d2354727 (diff)
[PATCH] RTC driver init adjustment
- conditionalizes procfs code upon CONFIG_PROC_FS (to reduce code size when that option is not enabled) - make initialization no longer fail when the procfs entry can't be allocated (namely would initialization always have failed when CONFIG_PROC_FS was not set) - move the formerly file-scope static variable rtc_int_handler_ptr into the only function using it, and makes it automatic. Signed-off-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/char/rtc.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 2eb53bea1866..e1d70e8b6268 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -113,7 +113,7 @@ 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;} 116static irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id) {return 0;}
117#else 117#else
118extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id); 118extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id);
119#endif 119#endif
@@ -165,7 +165,9 @@ static void mask_rtc_irq_bit(unsigned char bit)
165} 165}
166#endif 166#endif
167 167
168#ifdef CONFIG_PROC_FS
168static int rtc_proc_open(struct inode *inode, struct file *file); 169static int rtc_proc_open(struct inode *inode, struct file *file);
170#endif
169 171
170/* 172/*
171 * Bits in rtc_status. (6 bits of room for future expansion) 173 * Bits in rtc_status. (6 bits of room for future expansion)
@@ -906,6 +908,7 @@ static struct miscdevice rtc_dev = {
906 .fops = &rtc_fops, 908 .fops = &rtc_fops,
907}; 909};
908 910
911#ifdef CONFIG_PROC_FS
909static const struct file_operations rtc_proc_fops = { 912static const struct file_operations rtc_proc_fops = {
910 .owner = THIS_MODULE, 913 .owner = THIS_MODULE,
911 .open = rtc_proc_open, 914 .open = rtc_proc_open,
@@ -913,14 +916,13 @@ static const struct file_operations rtc_proc_fops = {
913 .llseek = seq_lseek, 916 .llseek = seq_lseek,
914 .release = single_release, 917 .release = single_release,
915}; 918};
916
917#if defined(RTC_IRQ) && !defined(__sparc__)
918static irq_handler_t rtc_int_handler_ptr;
919#endif 919#endif
920 920
921static int __init rtc_init(void) 921static int __init rtc_init(void)
922{ 922{
923#ifdef CONFIG_PROC_FS
923 struct proc_dir_entry *ent; 924 struct proc_dir_entry *ent;
925#endif
924#if defined(__alpha__) || defined(__mips__) 926#if defined(__alpha__) || defined(__mips__)
925 unsigned int year, ctrl; 927 unsigned int year, ctrl;
926 char *guess = NULL; 928 char *guess = NULL;
@@ -932,9 +934,11 @@ static int __init rtc_init(void)
932 struct sparc_isa_bridge *isa_br; 934 struct sparc_isa_bridge *isa_br;
933 struct sparc_isa_device *isa_dev; 935 struct sparc_isa_device *isa_dev;
934#endif 936#endif
935#endif 937#else
936#ifndef __sparc__
937 void *r; 938 void *r;
939#ifdef RTC_IRQ
940 irq_handler_t rtc_int_handler_ptr;
941#endif
938#endif 942#endif
939 943
940#ifdef __sparc__ 944#ifdef __sparc__
@@ -1024,17 +1028,13 @@ no_irq:
1024 return -ENODEV; 1028 return -ENODEV;
1025 } 1029 }
1026 1030
1031#ifdef CONFIG_PROC_FS
1027 ent = create_proc_entry("driver/rtc", 0, NULL); 1032 ent = create_proc_entry("driver/rtc", 0, NULL);
1028 if (!ent) { 1033 if (ent)
1029#ifdef RTC_IRQ 1034 ent->proc_fops = &rtc_proc_fops;
1030 free_irq(RTC_IRQ, NULL); 1035 else
1031 rtc_has_irq = 0; 1036 printk(KERN_WARNING "rtc: Failed to register with procfs.\n");
1032#endif 1037#endif
1033 release_region(RTC_PORT(0), RTC_IO_EXTENT);
1034 misc_deregister(&rtc_dev);
1035 return -ENOMEM;
1036 }
1037 ent->proc_fops = &rtc_proc_fops;
1038 1038
1039#if defined(__alpha__) || defined(__mips__) 1039#if defined(__alpha__) || defined(__mips__)
1040 rtc_freq = HZ; 1040 rtc_freq = HZ;
@@ -1167,6 +1167,7 @@ static void rtc_dropped_irq(unsigned long data)
1167} 1167}
1168#endif 1168#endif
1169 1169
1170#ifdef CONFIG_PROC_FS
1170/* 1171/*
1171 * Info exported via "/proc/driver/rtc". 1172 * Info exported via "/proc/driver/rtc".
1172 */ 1173 */
@@ -1251,6 +1252,7 @@ static int rtc_proc_open(struct inode *inode, struct file *file)
1251{ 1252{
1252 return single_open(file, rtc_proc_show, NULL); 1253 return single_open(file, rtc_proc_show, NULL);
1253} 1254}
1255#endif
1254 1256
1255void rtc_get_rtc_time(struct rtc_time *rtc_tm) 1257void rtc_get_rtc_time(struct rtc_time *rtc_tm)
1256{ 1258{