]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/rtc/class.c
Merge tag 'for-linus-5.4-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / drivers / rtc / class.c
index ac93b76f2b118bf8634470ab14d91f600bd48422..9458e6d6686aca8aeb6e0722c894114beb6ba652 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * RTC subsystem, base class
  *
@@ -5,11 +6,7 @@
  * Author: Alessandro Zummo <a.zummo@towertech.it>
  *
  * class skeleton from drivers/hwmon/hwmon.c
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
+ */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 
 #include "rtc-core.h"
 
-
 static DEFINE_IDA(rtc_ida);
 struct class *rtc_class;
 
 static void rtc_device_release(struct device *dev)
 {
        struct rtc_device *rtc = to_rtc_device(dev);
+
        ida_simple_remove(&rtc_ida, rtc->id);
        kfree(rtc);
 }
@@ -47,7 +44,6 @@ int rtc_hctosys_ret = -ENODEV;
 
 static struct timespec64 old_rtc, old_system, old_delta;
 
-
 static int rtc_suspend(struct device *dev)
 {
        struct rtc_device       *rtc = to_rtc_device(dev);
@@ -71,7 +67,6 @@ static int rtc_suspend(struct device *dev)
        ktime_get_real_ts64(&old_system);
        old_rtc.tv_sec = rtc_tm_to_time64(&tm);
 
-
        /*
         * To avoid drift caused by repeated suspend/resumes,
         * which each can add ~1 second drift error,
@@ -83,7 +78,7 @@ static int rtc_suspend(struct device *dev)
        if (delta_delta.tv_sec < -2 || delta_delta.tv_sec >= 2) {
                /*
                 * if delta_delta is too large, assume time correction
-                * has occured and set old_delta to the current delta.
+                * has occurred and set old_delta to the current delta.
                 */
                old_delta = delta;
        } else {
@@ -136,7 +131,7 @@ static int rtc_resume(struct device *dev)
         * to keep things accurate.
         */
        sleep_time = timespec64_sub(sleep_time,
-                       timespec64_sub(new_system, old_system));
+                                   timespec64_sub(new_system, old_system));
 
        if (sleep_time.tv_sec >= 0)
                timekeeping_inject_sleeptime64(&sleep_time);
@@ -351,8 +346,10 @@ int __rtc_register_device(struct module *owner, struct rtc_device *rtc)
        struct rtc_wkalrm alrm;
        int err;
 
-       if (!rtc->ops)
+       if (!rtc->ops) {
+               dev_dbg(&rtc->dev, "no ops set\n");
                return -EINVAL;
+       }
 
        rtc->owner = owner;
        rtc_device_get_offset(rtc);
@@ -397,9 +394,9 @@ EXPORT_SYMBOL_GPL(__rtc_register_device);
  * rtc_register_device instead
  */
 struct rtc_device *devm_rtc_device_register(struct device *dev,
-                                       const char *name,
-                                       const struct rtc_class_ops *ops,
-                                       struct module *owner)
+                                           const char *name,
+                                           const struct rtc_class_ops *ops,
+                                           struct module *owner)
 {
        struct rtc_device *rtc;
        int err;