aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/bvme6000/rtc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-17 13:54:29 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-17 13:54:29 -0700
commitba2e1c5f25a99dec3873745031ad23ce3fd79bff (patch)
treeebcc8e9b0f395033e8ba1db8e30fb6ea78edc442 /arch/m68k/bvme6000/rtc.c
parentMerge git://git.kernel.org/pub/scm/linux/kernel/git/joern/logfs (diff)
parentm68k: amiga - Floppy platform device conversion (diff)
downloadlinux-dev-ba2e1c5f25a99dec3873745031ad23ce3fd79bff.tar.xz
linux-dev-ba2e1c5f25a99dec3873745031ad23ce3fd79bff.zip
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k: m68k: amiga - Floppy platform device conversion m68k: amiga - Sound platform device conversion m68k: amiga - Frame buffer platform device conversion m68k: amiga - Zorro host bridge platform device conversion m68k: amiga - Zorro bus modalias support platform: Make platform resource input parameters const m68k: invoke oom-killer from page fault serial167: Kill unused variables m68k: Implement generic_find_next_{zero_,}le_bit() m68k: hp300 - Checkpatch cleanup m68k: Remove trailing spaces in messages m68k: Simplify param.h by using <asm-generic/param.h> m68k: Remove BKL from rtc implementations
Diffstat (limited to 'arch/m68k/bvme6000/rtc.c')
-rw-r--r--arch/m68k/bvme6000/rtc.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/arch/m68k/bvme6000/rtc.c b/arch/m68k/bvme6000/rtc.c
index b46ea1714a89..cb8617bb194b 100644
--- a/arch/m68k/bvme6000/rtc.c
+++ b/arch/m68k/bvme6000/rtc.c
@@ -9,7 +9,6 @@
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/miscdevice.h>
-#include <linux/smp_lock.h>
#include <linux/ioport.h>
#include <linux/capability.h>
#include <linux/fcntl.h>
@@ -35,10 +34,9 @@
static unsigned char days_in_mo[] =
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-static char rtc_status;
+static atomic_t rtc_status = ATOMIC_INIT(1);
-static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
- unsigned long arg)
+static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
volatile RtcPtr_t rtc = (RtcPtr_t)BVME_RTC_BASE;
unsigned char msr;
@@ -132,29 +130,20 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
}
/*
- * We enforce only one user at a time here with the open/close.
- * Also clear the previous interrupt data on an open, and clean
- * up things on a close.
+ * We enforce only one user at a time here with the open/close.
*/
-
static int rtc_open(struct inode *inode, struct file *file)
{
- lock_kernel();
- if(rtc_status) {
- unlock_kernel();
+ if (!atomic_dec_and_test(&rtc_status)) {
+ atomic_inc(&rtc_status);
return -EBUSY;
}
-
- rtc_status = 1;
- unlock_kernel();
return 0;
}
static int rtc_release(struct inode *inode, struct file *file)
{
- lock_kernel();
- rtc_status = 0;
- unlock_kernel();
+ atomic_inc(&rtc_status);
return 0;
}
@@ -163,9 +152,9 @@ static int rtc_release(struct inode *inode, struct file *file)
*/
static const struct file_operations rtc_fops = {
- .ioctl = rtc_ioctl,
- .open = rtc_open,
- .release = rtc_release,
+ .unlocked_ioctl = rtc_ioctl,
+ .open = rtc_open,
+ .release = rtc_release,
};
static struct miscdevice rtc_dev = {