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.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index dc4c2748bbc3..f8a0aab218cb 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -31,8 +31,12 @@ static void rtc_device_release(struct device *dev)
31 kfree(rtc); 31 kfree(rtc);
32} 32}
33 33
34#if defined(CONFIG_PM) && defined(CONFIG_RTC_HCTOSYS_DEVICE) 34#ifdef CONFIG_RTC_HCTOSYS_DEVICE
35/* Result of the last RTC to system clock attempt. */
36int rtc_hctosys_ret = -ENODEV;
37#endif
35 38
39#if defined(CONFIG_PM) && defined(CONFIG_RTC_HCTOSYS_DEVICE)
36/* 40/*
37 * On suspend(), measure the delta between one RTC and the 41 * On suspend(), measure the delta between one RTC and the
38 * system's wall clock; restore it on resume(). 42 * system's wall clock; restore it on resume().
@@ -84,6 +88,7 @@ static int rtc_resume(struct device *dev)
84 struct timespec new_system, new_rtc; 88 struct timespec new_system, new_rtc;
85 struct timespec sleep_time; 89 struct timespec sleep_time;
86 90
91 rtc_hctosys_ret = -ENODEV;
87 if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0) 92 if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0)
88 return 0; 93 return 0;
89 94
@@ -117,6 +122,7 @@ static int rtc_resume(struct device *dev)
117 122
118 if (sleep_time.tv_sec >= 0) 123 if (sleep_time.tv_sec >= 0)
119 timekeeping_inject_sleeptime(&sleep_time); 124 timekeeping_inject_sleeptime(&sleep_time);
125 rtc_hctosys_ret = 0;
120 return 0; 126 return 0;
121} 127}
122 128
@@ -238,6 +244,7 @@ void rtc_device_unregister(struct rtc_device *rtc)
238 rtc_proc_del_device(rtc); 244 rtc_proc_del_device(rtc);
239 device_unregister(&rtc->dev); 245 device_unregister(&rtc->dev);
240 rtc->ops = NULL; 246 rtc->ops = NULL;
247 ida_simple_remove(&rtc_ida, rtc->id);
241 mutex_unlock(&rtc->ops_lock); 248 mutex_unlock(&rtc->ops_lock);
242 put_device(&rtc->dev); 249 put_device(&rtc->dev);
243 } 250 }