mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 16:41:25 +00:00
rtc: use set_mmss when set_time is not available
Drivers should only need to implement either set_mmss (counter based RTCs) or set_time (most RTCs). The RTC subsystem will handle them appropriately. Signed-off-by: Alessandro Zummo <a.zummo@towertech.it> Cc: Kumar Gala <galak@kernel.crashing.org> Cc: David Brownell <david-b@pacbell.net> Cc: Lennert Buytenhek <buytenh@wantstofly.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
f60091575d
commit
bbccf83f6c
4 changed files with 9 additions and 45 deletions
|
@ -50,10 +50,15 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
|
|||
|
||||
if (!rtc->ops)
|
||||
err = -ENODEV;
|
||||
else if (!rtc->ops->set_time)
|
||||
err = -EINVAL;
|
||||
else
|
||||
else if (rtc->ops->set_time)
|
||||
err = rtc->ops->set_time(rtc->dev.parent, tm);
|
||||
else if (rtc->ops->set_mmss) {
|
||||
unsigned long secs;
|
||||
err = rtc_tm_to_time(tm, &secs);
|
||||
if (err == 0)
|
||||
err = rtc->ops->set_mmss(rtc->dev.parent, secs);
|
||||
} else
|
||||
err = -EINVAL;
|
||||
|
||||
mutex_unlock(&rtc->ops_lock);
|
||||
return err;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue