DSS2: Documentation update for new sysfs entries in omapdss/manager
[pandora-kernel.git] / drivers / rtc / rtc-dev.c
index 856cc1a..52e2743 100644 (file)
@@ -13,7 +13,6 @@
 
 #include <linux/module.h>
 #include <linux/rtc.h>
-#include <linux/smp_lock.h>
 #include "rtc-core.h"
 
 static dev_t rtc_devt;
@@ -27,11 +26,8 @@ static int rtc_dev_open(struct inode *inode, struct file *file)
                                        struct rtc_device, char_dev);
        const struct rtc_class_ops *ops = rtc->ops;
 
-       lock_kernel();
-       if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) {
-               err = -EBUSY;
-               goto out;
-       }
+       if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags))
+               return -EBUSY;
 
        file->private_data = rtc;
 
@@ -41,13 +37,11 @@ static int rtc_dev_open(struct inode *inode, struct file *file)
                rtc->irq_data = 0;
                spin_unlock_irq(&rtc->irq_lock);
 
-               goto out;
+               return 0;
        }
 
        /* something has gone wrong */
        clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
-out:
-       unlock_kernel();
        return err;
 }
 
@@ -409,11 +403,14 @@ static long rtc_dev_ioctl(struct file *file,
 
 #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
        case RTC_UIE_OFF:
+               mutex_unlock(&rtc->ops_lock);
                clear_uie(rtc);
-               break;
+               return 0;
 
        case RTC_UIE_ON:
+               mutex_unlock(&rtc->ops_lock);
                err = set_uie(rtc);
+               return err;
 #endif
        default:
                err = -ENOTTY;
@@ -425,6 +422,12 @@ done:
        return err;
 }
 
+static int rtc_dev_fasync(int fd, struct file *file, int on)
+{
+       struct rtc_device *rtc = file->private_data;
+       return fasync_helper(fd, file, on, &rtc->async_queue);
+}
+
 static int rtc_dev_release(struct inode *inode, struct file *file)
 {
        struct rtc_device *rtc = file->private_data;
@@ -437,16 +440,13 @@ static int rtc_dev_release(struct inode *inode, struct file *file)
        if (rtc->ops->release)
                rtc->ops->release(rtc->dev.parent);
 
+       if (file->f_flags & FASYNC)
+               rtc_dev_fasync(-1, file, 0);
+
        clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
        return 0;
 }
 
-static int rtc_dev_fasync(int fd, struct file *file, int on)
-{
-       struct rtc_device *rtc = file->private_data;
-       return fasync_helper(fd, file, on, &rtc->async_queue);
-}
-
 static const struct file_operations rtc_dev_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,