patch-2.4.0-test5 linux/drivers/char/rtc.c
Next file: linux/drivers/char/scan_keyb.c
Previous file: linux/drivers/char/random.c
Back to the patch index
Back to the overall index
- Lines: 182
- Date:
Wed Jul 19 11:27:45 2000
- Orig file:
v2.4.0-test4/linux/drivers/char/rtc.c
- Orig date:
Fri Jul 14 12:12:09 2000
diff -u --recursive --new-file v2.4.0-test4/linux/drivers/char/rtc.c linux/drivers/char/rtc.c
@@ -43,7 +43,6 @@
#define RTC_VERSION "1.10c"
-#define RTC_IRQ 8 /* Can't see this changing soon. */
#define RTC_IO_EXTENT 0x10 /* Only really two ports, but... */
/*
@@ -54,6 +53,7 @@
* this driver.)
*/
+#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
@@ -100,13 +100,13 @@
static int rtc_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
-#ifndef __alpha__
+#if RTC_IRQ
static unsigned int rtc_poll(struct file *file, poll_table *wait);
#endif
static void get_rtc_time (struct rtc_time *rtc_tm);
static void get_rtc_alm_time (struct rtc_time *alm_tm);
-#ifndef __alpha__
+#if RTC_IRQ
static void rtc_dropped_irq(unsigned long data);
static void set_rtc_irq_bit(unsigned char bit);
@@ -146,7 +146,7 @@
static const unsigned char days_in_mo[] =
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-#ifndef __alpha__
+#if RTC_IRQ
/*
* A very tiny interrupt handler. It runs with SA_INTERRUPT set,
* but there is possibility of conflicting with the set_rtc_mmss()
@@ -195,7 +195,7 @@
static ssize_t rtc_read(struct file *file, char *buf,
size_t count, loff_t *ppos)
{
-#ifdef __alpha__
+#if !RTC_IRQ
return -EIO;
#else
DECLARE_WAITQUEUE(wait, current);
@@ -249,7 +249,7 @@
struct rtc_time wtime;
switch (cmd) {
-#ifndef __alpha__
+#if RTC_IRQ
case RTC_AIE_OFF: /* Mask alarm int. enab. bit */
{
mask_rtc_irq_bit(RTC_AIE);
@@ -434,7 +434,7 @@
spin_unlock_irq(&rtc_lock);
return 0;
}
-#ifndef __alpha__
+#if RTC_IRQ
case RTC_IRQP_READ: /* Read the periodic IRQ rate. */
{
return put_user(rtc_freq, (unsigned long *)arg);
@@ -474,7 +474,7 @@
spin_unlock_irq(&rtc_lock);
return 0;
}
-#else
+#elif !defined(CONFIG_DECSTATION)
case RTC_EPOCH_READ: /* Read the epoch. */
{
return put_user (epoch, (unsigned long *)arg);
@@ -534,7 +534,7 @@
static int rtc_release(struct inode *inode, struct file *file)
{
-#ifndef __alpha__
+#if RTC_IRQ
/*
* Turn off all interrupts once the device is no longer
* in use, and clear the data.
@@ -571,7 +571,7 @@
return 0;
}
-#ifndef __alpha__
+#if RTC_IRQ
/* Called without the kernel lock - fine */
static unsigned int rtc_poll(struct file *file, poll_table *wait)
{
@@ -597,7 +597,7 @@
owner: THIS_MODULE,
llseek: rtc_llseek,
read: rtc_read,
-#ifndef __alpha__
+#if RTC_IRQ
poll: rtc_poll,
#endif
ioctl: rtc_ioctl,
@@ -615,7 +615,7 @@
static int __init rtc_init(void)
{
-#ifdef __alpha__
+#if defined(__alpha__) || defined(__mips__)
unsigned int year, ctrl;
unsigned long uip_watchdog;
char *guess = NULL;
@@ -659,7 +659,7 @@
return -EIO;
}
-#ifndef __alpha__
+#if RTC_IRQ
if(request_irq(RTC_IRQ, rtc_interrupt, SA_INTERRUPT, "rtc", NULL))
{
/* Yeah right, seeing as irq 8 doesn't even hit the bus. */
@@ -674,7 +674,7 @@
misc_register(&rtc_dev);
create_proc_read_entry ("driver/rtc", 0, 0, rtc_read_proc, NULL);
-#ifdef __alpha__
+#if defined(__alpha__) || defined(__mips__)
rtc_freq = HZ;
/* Each operating system on an Alpha uses its own epoch.
@@ -693,17 +693,20 @@
if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
BCD_TO_BIN(year); /* This should never happen... */
- if (year >= 20 && year < 48) {
+ if (year > 20 && year < 48) {
epoch = 1980;
guess = "ARC console";
- } else if (year >= 48 && year < 100) {
+ } else if (year >= 48 && year < 70) {
epoch = 1952;
guess = "Digital UNIX";
+ } else if (year >= 70 && year < 100) {
+ epoch = 1928;
+ guess = "Digital DECstation";
}
if (guess)
printk("rtc: %s epoch (%lu) detected\n", guess, epoch);
#endif
-#ifndef __alpha__
+#if RTC_IRQ
init_timer(&rtc_irq_timer);
rtc_irq_timer.function = rtc_dropped_irq;
spin_lock_irq(&rtc_lock);
@@ -739,7 +742,7 @@
free_irq (rtc_irq, &rtc_port);
#else
release_region (RTC_PORT (0), RTC_IO_EXTENT);
-#ifndef __alpha__
+#if RTC_IRQ
free_irq (RTC_IRQ, NULL);
#endif
#endif /* __sparc__ */
@@ -749,7 +752,7 @@
module_exit(rtc_exit);
EXPORT_NO_SYMBOLS;
-#ifndef __alpha__
+#if RTC_IRQ
/*
* At IRQ rates >= 4096Hz, an interrupt may get lost altogether.
* (usually during an IDE disk interrupt, with IRQ unmasking off)
@@ -975,7 +978,7 @@
}
}
-#ifndef __alpha__
+#if RTC_IRQ
/*
* Used to disable/enable interrupts for any one of UIE, AIE, PIE.
* Rumour has it that if you frob the interrupt enable/disable
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)