Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 133350
b: refs/heads/master
c: edf2247
h: refs/heads/master
v: v3
  • Loading branch information
Magnus Damm authored and Paul Mundt committed Mar 20, 2009
1 parent 886cb2b commit ecc44b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9cd88b90a6008b0d744187fab80ade4c81c6536f
refs/heads/master: edf22477dab5ff3be612af56ee4300ca63e11d06
15 changes: 9 additions & 6 deletions trunk/drivers/rtc/rtc-sh.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,12 +431,7 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon + 1, tm->tm_year, tm->tm_wday);

if (rtc_valid_tm(tm) < 0) {
dev_err(dev, "invalid date\n");
rtc_time_to_tm(0, tm);
}

return 0;
return rtc_valid_tm(tm);
}

static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm)
Expand Down Expand Up @@ -641,6 +636,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev)
{
struct sh_rtc *rtc;
struct resource *res;
struct rtc_time r;
int ret;

rtc = kzalloc(sizeof(struct sh_rtc), GFP_KERNEL);
Expand Down Expand Up @@ -752,6 +748,13 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev)
sh_rtc_setpie(&pdev->dev, 0);
sh_rtc_setaie(&pdev->dev, 0);
sh_rtc_setcie(&pdev->dev, 0);

/* reset rtc to epoch 0 if time is invalid */
if (rtc_read_time(rtc->rtc_dev, &r) < 0) {
rtc_time_to_tm(0, &r);
rtc_set_time(rtc->rtc_dev, &r);
}

return 0;

err_unmap:
Expand Down

0 comments on commit ecc44b2

Please sign in to comment.