diff options
Diffstat (limited to 'arch/arm/common/rtctime.c')
-rw-r--r-- | arch/arm/common/rtctime.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c index 72b03f201eb9..00f6278f42b8 100644 --- a/arch/arm/common/rtctime.c +++ b/arch/arm/common/rtctime.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/miscdevice.h> | 18 | #include <linux/miscdevice.h> |
19 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/mutex.h> | ||
21 | 22 | ||
22 | #include <asm/rtc.h> | 23 | #include <asm/rtc.h> |
23 | #include <asm/semaphore.h> | 24 | #include <asm/semaphore.h> |
@@ -34,7 +35,7 @@ static unsigned long rtc_irq_data; | |||
34 | /* | 35 | /* |
35 | * rtc_sem protects rtc_inuse and rtc_ops | 36 | * rtc_sem protects rtc_inuse and rtc_ops |
36 | */ | 37 | */ |
37 | static DECLARE_MUTEX(rtc_sem); | 38 | static DEFINE_MUTEX(rtc_mutex); |
38 | static unsigned long rtc_inuse; | 39 | static unsigned long rtc_inuse; |
39 | static struct rtc_ops *rtc_ops; | 40 | static struct rtc_ops *rtc_ops; |
40 | 41 | ||
@@ -355,7 +356,7 @@ static int rtc_open(struct inode *inode, struct file *file) | |||
355 | { | 356 | { |
356 | int ret; | 357 | int ret; |
357 | 358 | ||
358 | down(&rtc_sem); | 359 | mutex_lock(&rtc_mutex); |
359 | 360 | ||
360 | if (rtc_inuse) { | 361 | if (rtc_inuse) { |
361 | ret = -EBUSY; | 362 | ret = -EBUSY; |
@@ -373,7 +374,7 @@ static int rtc_open(struct inode *inode, struct file *file) | |||
373 | rtc_inuse = 1; | 374 | rtc_inuse = 1; |
374 | } | 375 | } |
375 | } | 376 | } |
376 | up(&rtc_sem); | 377 | mutex_unlock(&rtc_mutex); |
377 | 378 | ||
378 | return ret; | 379 | return ret; |
379 | } | 380 | } |
@@ -479,7 +480,7 @@ int register_rtc(struct rtc_ops *ops) | |||
479 | { | 480 | { |
480 | int ret = -EBUSY; | 481 | int ret = -EBUSY; |
481 | 482 | ||
482 | down(&rtc_sem); | 483 | mutex_lock(&rtc_mutex); |
483 | if (rtc_ops == NULL) { | 484 | if (rtc_ops == NULL) { |
484 | rtc_ops = ops; | 485 | rtc_ops = ops; |
485 | 486 | ||
@@ -488,7 +489,7 @@ int register_rtc(struct rtc_ops *ops) | |||
488 | create_proc_read_entry("driver/rtc", 0, NULL, | 489 | create_proc_read_entry("driver/rtc", 0, NULL, |
489 | rtc_read_proc, ops); | 490 | rtc_read_proc, ops); |
490 | } | 491 | } |
491 | up(&rtc_sem); | 492 | mutex_unlock(&rtc_mutex); |
492 | 493 | ||
493 | return ret; | 494 | return ret; |
494 | } | 495 | } |
@@ -496,12 +497,12 @@ EXPORT_SYMBOL(register_rtc); | |||
496 | 497 | ||
497 | void unregister_rtc(struct rtc_ops *rtc) | 498 | void unregister_rtc(struct rtc_ops *rtc) |
498 | { | 499 | { |
499 | down(&rtc_sem); | 500 | mutex_lock(&rtc_mutex); |
500 | if (rtc == rtc_ops) { | 501 | if (rtc == rtc_ops) { |
501 | remove_proc_entry("driver/rtc", NULL); | 502 | remove_proc_entry("driver/rtc", NULL); |
502 | misc_deregister(&rtc_miscdev); | 503 | misc_deregister(&rtc_miscdev); |
503 | rtc_ops = NULL; | 504 | rtc_ops = NULL; |
504 | } | 505 | } |
505 | up(&rtc_sem); | 506 | mutex_unlock(&rtc_mutex); |
506 | } | 507 | } |
507 | EXPORT_SYMBOL(unregister_rtc); | 508 | EXPORT_SYMBOL(unregister_rtc); |