Merge branch 'r6040' of git://git.kernel.org/pub/scm/linux/kernel/git/romieu/netdev...
[sfrench/cifs-2.6.git] / drivers / rtc / rtc-dev.c
index ae1bf177d62546d4a9225ee40dd208a184403612..90dfa0df747acb9314b4ed115c2eec0dee1eae0d 100644 (file)
@@ -26,7 +26,7 @@ static int rtc_dev_open(struct inode *inode, struct file *file)
                                        struct rtc_device, char_dev);
        const struct rtc_class_ops *ops = rtc->ops;
 
-       if (test_and_set_bit(RTC_DEV_BUSY, &rtc->flags))
+       if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags))
                return -EBUSY;
 
        file->private_data = rtc;
@@ -41,7 +41,7 @@ static int rtc_dev_open(struct inode *inode, struct file *file)
        }
 
        /* something has gone wrong */
-       clear_bit(RTC_DEV_BUSY, &rtc->flags);
+       clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
        return err;
 }
 
@@ -246,6 +246,15 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,
        /* if the driver does not provide the ioctl interface
         * or if that particular ioctl was not implemented
         * (-ENOIOCTLCMD), we will try to emulate here.
+        *
+        * Drivers *SHOULD NOT* provide ioctl implementations
+        * for these requests.  Instead, provide methods to
+        * support the following code, so that the RTC's main
+        * features are accessible without using ioctls.
+        *
+        * RTC and alarm times will be in UTC, by preference,
+        * but dual-booting with MS-Windows implies RTCs must
+        * use the local wall clock time.
         */
 
        switch (cmd) {
@@ -402,7 +411,7 @@ static int rtc_dev_release(struct inode *inode, struct file *file)
        if (rtc->ops->release)
                rtc->ops->release(rtc->dev.parent);
 
-       clear_bit(RTC_DEV_BUSY, &rtc->flags);
+       clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
        return 0;
 }