aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/common
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-01-12 15:23:49 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-12 15:23:49 -0500
commitbf785ee0aeea7a3e717cb1e11df4135b6cbde7da (patch)
tree32ae52ad51c2a3952f2e1a2af9217717954fa593 /arch/arm/common
parent8b87e1baff24e586c3fe6c168843d213119bf4dd (diff)
parent00431707be0cc1236ee08459367872b57da5be29 (diff)
Merge master.kernel.org:/home/rmk/linux-2.6-arm
Diffstat (limited to 'arch/arm/common')
-rw-r--r--arch/arm/common/rtctime.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c
index ffb82d5bedef..48b1e19b131f 100644
--- a/arch/arm/common/rtctime.c
+++ b/arch/arm/common/rtctime.c
@@ -19,6 +19,7 @@
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/capability.h> 20#include <linux/capability.h>
21#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/mutex.h>
22 23
23#include <asm/rtc.h> 24#include <asm/rtc.h>
24#include <asm/semaphore.h> 25#include <asm/semaphore.h>
@@ -35,7 +36,7 @@ static unsigned long rtc_irq_data;
35/* 36/*
36 * rtc_sem protects rtc_inuse and rtc_ops 37 * rtc_sem protects rtc_inuse and rtc_ops
37 */ 38 */
38static DECLARE_MUTEX(rtc_sem); 39static DEFINE_MUTEX(rtc_mutex);
39static unsigned long rtc_inuse; 40static unsigned long rtc_inuse;
40static struct rtc_ops *rtc_ops; 41static struct rtc_ops *rtc_ops;
41 42
@@ -356,7 +357,7 @@ static int rtc_open(struct inode *inode, struct file *file)
356{ 357{
357 int ret; 358 int ret;
358 359
359 down(&rtc_sem); 360 mutex_lock(&rtc_mutex);
360 361
361 if (rtc_inuse) { 362 if (rtc_inuse) {
362 ret = -EBUSY; 363 ret = -EBUSY;
@@ -374,7 +375,7 @@ static int rtc_open(struct inode *inode, struct file *file)
374 rtc_inuse = 1; 375 rtc_inuse = 1;
375 } 376 }
376 } 377 }
377 up(&rtc_sem); 378 mutex_unlock(&rtc_mutex);
378 379
379 return ret; 380 return ret;
380} 381}
@@ -480,7 +481,7 @@ int register_rtc(struct rtc_ops *ops)
480{ 481{
481 int ret = -EBUSY; 482 int ret = -EBUSY;
482 483
483 down(&rtc_sem); 484 mutex_lock(&rtc_mutex);
484 if (rtc_ops == NULL) { 485 if (rtc_ops == NULL) {
485 rtc_ops = ops; 486 rtc_ops = ops;
486 487
@@ -489,7 +490,7 @@ int register_rtc(struct rtc_ops *ops)
489 create_proc_read_entry("driver/rtc", 0, NULL, 490 create_proc_read_entry("driver/rtc", 0, NULL,
490 rtc_read_proc, ops); 491 rtc_read_proc, ops);
491 } 492 }
492 up(&rtc_sem); 493 mutex_unlock(&rtc_mutex);
493 494
494 return ret; 495 return ret;
495} 496}
@@ -497,12 +498,12 @@ EXPORT_SYMBOL(register_rtc);
497 498
498void unregister_rtc(struct rtc_ops *rtc) 499void unregister_rtc(struct rtc_ops *rtc)
499{ 500{
500 down(&rtc_sem); 501 mutex_lock(&rtc_mutex);
501 if (rtc == rtc_ops) { 502 if (rtc == rtc_ops) {
502 remove_proc_entry("driver/rtc", NULL); 503 remove_proc_entry("driver/rtc", NULL);
503 misc_deregister(&rtc_miscdev); 504 misc_deregister(&rtc_miscdev);
504 rtc_ops = NULL; 505 rtc_ops = NULL;
505 } 506 }
506 up(&rtc_sem); 507 mutex_unlock(&rtc_mutex);
507} 508}
508EXPORT_SYMBOL(unregister_rtc); 509EXPORT_SYMBOL(unregister_rtc);