diff options
Diffstat (limited to 'drivers/rtc/interface.c')
-rw-r--r-- | drivers/rtc/interface.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 50482d1321e..4348c4b0d45 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -50,10 +50,15 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm) | |||
50 | 50 | ||
51 | if (!rtc->ops) | 51 | if (!rtc->ops) |
52 | err = -ENODEV; | 52 | err = -ENODEV; |
53 | else if (!rtc->ops->set_time) | 53 | else if (rtc->ops->set_time) |
54 | err = -EINVAL; | ||
55 | else | ||
56 | err = rtc->ops->set_time(rtc->dev.parent, tm); | 54 | err = rtc->ops->set_time(rtc->dev.parent, tm); |
55 | else if (rtc->ops->set_mmss) { | ||
56 | unsigned long secs; | ||
57 | err = rtc_tm_to_time(tm, &secs); | ||
58 | if (err == 0) | ||
59 | err = rtc->ops->set_mmss(rtc->dev.parent, secs); | ||
60 | } else | ||
61 | err = -EINVAL; | ||
57 | 62 | ||
58 | mutex_unlock(&rtc->ops_lock); | 63 | mutex_unlock(&rtc->ops_lock); |
59 | return err; | 64 | return err; |