diff options
| author | Jiri Kosina <jkosina@suse.cz> | 2014-11-20 08:42:02 -0500 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2014-11-20 08:42:02 -0500 |
| commit | a02001086bbfb4da35d1228bebc2f1b442db455f (patch) | |
| tree | 62ab47936cef06fd08657ca5b6cd1df98c19be57 /drivers/rtc/class.c | |
| parent | eff264efeeb0898408e8c9df72d8a32621035bed (diff) | |
| parent | fc14f9c1272f62c3e8d01300f52467c0d9af50f9 (diff) | |
Merge Linus' tree to be be to apply submitted patches to newer code than
current trivial.git base
Diffstat (limited to 'drivers/rtc/class.c')
| -rw-r--r-- | drivers/rtc/class.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 589351ef75d0..38e26be705be 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
| @@ -53,6 +53,7 @@ static int rtc_suspend(struct device *dev) | |||
| 53 | struct rtc_device *rtc = to_rtc_device(dev); | 53 | struct rtc_device *rtc = to_rtc_device(dev); |
| 54 | struct rtc_time tm; | 54 | struct rtc_time tm; |
| 55 | struct timespec delta, delta_delta; | 55 | struct timespec delta, delta_delta; |
| 56 | int err; | ||
| 56 | 57 | ||
| 57 | if (has_persistent_clock()) | 58 | if (has_persistent_clock()) |
| 58 | return 0; | 59 | return 0; |
| @@ -61,7 +62,12 @@ static int rtc_suspend(struct device *dev) | |||
| 61 | return 0; | 62 | return 0; |
| 62 | 63 | ||
| 63 | /* snapshot the current RTC and system time at suspend*/ | 64 | /* snapshot the current RTC and system time at suspend*/ |
| 64 | rtc_read_time(rtc, &tm); | 65 | err = rtc_read_time(rtc, &tm); |
| 66 | if (err < 0) { | ||
| 67 | pr_debug("%s: fail to read rtc time\n", dev_name(&rtc->dev)); | ||
| 68 | return 0; | ||
| 69 | } | ||
| 70 | |||
| 65 | getnstimeofday(&old_system); | 71 | getnstimeofday(&old_system); |
| 66 | rtc_tm_to_time(&tm, &old_rtc.tv_sec); | 72 | rtc_tm_to_time(&tm, &old_rtc.tv_sec); |
| 67 | 73 | ||
| @@ -94,6 +100,7 @@ static int rtc_resume(struct device *dev) | |||
| 94 | struct rtc_time tm; | 100 | struct rtc_time tm; |
| 95 | struct timespec new_system, new_rtc; | 101 | struct timespec new_system, new_rtc; |
| 96 | struct timespec sleep_time; | 102 | struct timespec sleep_time; |
| 103 | int err; | ||
| 97 | 104 | ||
| 98 | if (has_persistent_clock()) | 105 | if (has_persistent_clock()) |
| 99 | return 0; | 106 | return 0; |
| @@ -104,7 +111,12 @@ static int rtc_resume(struct device *dev) | |||
| 104 | 111 | ||
| 105 | /* snapshot the current rtc and system time at resume */ | 112 | /* snapshot the current rtc and system time at resume */ |
| 106 | getnstimeofday(&new_system); | 113 | getnstimeofday(&new_system); |
| 107 | rtc_read_time(rtc, &tm); | 114 | err = rtc_read_time(rtc, &tm); |
| 115 | if (err < 0) { | ||
| 116 | pr_debug("%s: fail to read rtc time\n", dev_name(&rtc->dev)); | ||
| 117 | return 0; | ||
| 118 | } | ||
| 119 | |||
| 108 | if (rtc_valid_tm(&tm) != 0) { | 120 | if (rtc_valid_tm(&tm) != 0) { |
| 109 | pr_debug("%s: bogus resume time\n", dev_name(&rtc->dev)); | 121 | pr_debug("%s: bogus resume time\n", dev_name(&rtc->dev)); |
| 110 | return 0; | 122 | return 0; |
