Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 33622
b: refs/heads/master
c: 641741e
h: refs/heads/master
v: v3
  • Loading branch information
Ben Dooks authored and Linus Torvalds committed Aug 27, 2006
1 parent 07efa2a commit 7392234
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 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: b6b5bce3571e496504a89ee575d32101e0a98b93
refs/heads/master: 641741e010b615bae417c876a21d17dbd616241f
15 changes: 8 additions & 7 deletions trunk/drivers/rtc/rtc-s3c.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,24 +153,25 @@ static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm)
{
void __iomem *base = s3c_rtc_base;
int year = tm->tm_year - 100;

/* the rtc gets round the y2k problem by just not supporting it */
pr_debug("set time %02d.%02d.%02d %02d/%02d/%02d\n",
tm->tm_year, tm->tm_mon, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);

/* we get around y2k by simply not supporting it */

if (tm->tm_year > 100) {
if (year < 0 || year >= 100) {
dev_err(dev, "rtc only supports 100 years\n");
return -EINVAL;
}

pr_debug("set time %02d.%02d.%02d %02d/%02d/%02d\n",
tm->tm_year, tm->tm_mon, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);

writeb(BIN2BCD(tm->tm_sec), base + S3C2410_RTCSEC);
writeb(BIN2BCD(tm->tm_min), base + S3C2410_RTCMIN);
writeb(BIN2BCD(tm->tm_hour), base + S3C2410_RTCHOUR);
writeb(BIN2BCD(tm->tm_mday), base + S3C2410_RTCDATE);
writeb(BIN2BCD(tm->tm_mon + 1), base + S3C2410_RTCMON);
writeb(BIN2BCD(tm->tm_year - 100), base + S3C2410_RTCYEAR);
writeb(BIN2BCD(year), base + S3C2410_RTCYEAR);

return 0;
}
Expand Down

0 comments on commit 7392234

Please sign in to comment.