patch-2.4.19 linux-2.4.19/arch/mips64/sgi-ip27/ip27-rtc.c
Next file: linux-2.4.19/arch/mips64/sgi-ip27/ip27-setup.c
Previous file: linux-2.4.19/arch/mips64/sgi-ip27/ip27-reset.c
Back to the patch index
Back to the overall index
- Lines: 49
- Date:
Fri Aug 2 17:39:43 2002
- Orig file:
linux-2.4.18/arch/mips64/sgi-ip27/ip27-rtc.c
- Orig date:
Tue Nov 28 21:42:04 2000
diff -urN linux-2.4.18/arch/mips64/sgi-ip27/ip27-rtc.c linux-2.4.19/arch/mips64/sgi-ip27/ip27-rtc.c
@@ -61,6 +61,7 @@
#define RTC_TIMER_ON 0x02 /* missed irq timer active */
static unsigned char rtc_status; /* bitmapped status byte. */
+static spinlock_t rtc_status_lock = SPIN_LOCK_UNLOCKED;
static unsigned long rtc_freq; /* Current periodic IRQ rate */
static struct m48t35_rtc *rtc;
@@ -166,10 +167,16 @@
static int rtc_open(struct inode *inode, struct file *file)
{
- if(rtc_status & RTC_IS_OPEN)
+ spin_lock(rtc_status_lock);
+
+ if (rtc_status & RTC_IS_OPEN) {
+ spin_unlock(rtc_status_lock);
return -EBUSY;
+ }
rtc_status |= RTC_IS_OPEN;
+ spin_unlock(rtc_status_lock);
+
return 0;
}
@@ -180,9 +187,10 @@
* in use, and clear the data.
*/
- lock_kernel();
+ spin_lock(rtc_status_lock);
rtc_status &= ~RTC_IS_OPEN;
- unlock_kernel();
+ spin_unlock(rtc_status_lock);
+
return 0;
}
@@ -214,7 +222,8 @@
KL_CONFIG_CH_CONS_INFO(nid)->memory_base + IOC3_BYTEBUS_DEV0;
printk(KERN_INFO "Real Time Clock Driver v%s\n", RTC_VERSION);
- misc_register(&rtc_dev);
+ if (misc_register(&rtc_dev))
+ return -ENODEV;
create_proc_read_entry ("rtc", 0, NULL, rtc_read_proc, NULL);
save_flags(flags);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)