aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/class.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/class.c')
-rw-r--r--drivers/rtc/class.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index f8a0aab218cb..9b742d3ffb94 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -11,6 +11,8 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12*/ 12*/
13 13
14#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15
14#include <linux/module.h> 16#include <linux/module.h>
15#include <linux/rtc.h> 17#include <linux/rtc.h>
16#include <linux/kdev_t.h> 18#include <linux/kdev_t.h>
@@ -50,6 +52,10 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg)
50 struct rtc_device *rtc = to_rtc_device(dev); 52 struct rtc_device *rtc = to_rtc_device(dev);
51 struct rtc_time tm; 53 struct rtc_time tm;
52 struct timespec delta, delta_delta; 54 struct timespec delta, delta_delta;
55
56 if (has_persistent_clock())
57 return 0;
58
53 if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0) 59 if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0)
54 return 0; 60 return 0;
55 61
@@ -88,6 +94,9 @@ static int rtc_resume(struct device *dev)
88 struct timespec new_system, new_rtc; 94 struct timespec new_system, new_rtc;
89 struct timespec sleep_time; 95 struct timespec sleep_time;
90 96
97 if (has_persistent_clock())
98 return 0;
99
91 rtc_hctosys_ret = -ENODEV; 100 rtc_hctosys_ret = -ENODEV;
92 if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0) 101 if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0)
93 return 0; 102 return 0;
@@ -244,7 +253,6 @@ void rtc_device_unregister(struct rtc_device *rtc)
244 rtc_proc_del_device(rtc); 253 rtc_proc_del_device(rtc);
245 device_unregister(&rtc->dev); 254 device_unregister(&rtc->dev);
246 rtc->ops = NULL; 255 rtc->ops = NULL;
247 ida_simple_remove(&rtc_ida, rtc->id);
248 mutex_unlock(&rtc->ops_lock); 256 mutex_unlock(&rtc->ops_lock);
249 put_device(&rtc->dev); 257 put_device(&rtc->dev);
250 } 258 }
@@ -255,7 +263,7 @@ static int __init rtc_init(void)
255{ 263{
256 rtc_class = class_create(THIS_MODULE, "rtc"); 264 rtc_class = class_create(THIS_MODULE, "rtc");
257 if (IS_ERR(rtc_class)) { 265 if (IS_ERR(rtc_class)) {
258 printk(KERN_ERR "%s: couldn't create class\n", __FILE__); 266 pr_err("couldn't create class\n");
259 return PTR_ERR(rtc_class); 267 return PTR_ERR(rtc_class);
260 } 268 }
261 rtc_class->suspend = rtc_suspend; 269 rtc_class->suspend = rtc_suspend;