diff options
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-ds1307.c | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index fec13e7d48ef..7e5155e88ac7 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c | |||
@@ -287,7 +287,7 @@ static int ds1307_set_time(struct device *dev, struct rtc_time *t) | |||
287 | return 0; | 287 | return 0; |
288 | } | 288 | } |
289 | 289 | ||
290 | static int ds1307_read_alarm(struct device *dev, struct rtc_wkalrm *t) | 290 | static int ds1337_read_alarm(struct device *dev, struct rtc_wkalrm *t) |
291 | { | 291 | { |
292 | struct i2c_client *client = to_i2c_client(dev); | 292 | struct i2c_client *client = to_i2c_client(dev); |
293 | struct ds1307 *ds1307 = i2c_get_clientdata(client); | 293 | struct ds1307 *ds1307 = i2c_get_clientdata(client); |
@@ -338,7 +338,7 @@ static int ds1307_read_alarm(struct device *dev, struct rtc_wkalrm *t) | |||
338 | return 0; | 338 | return 0; |
339 | } | 339 | } |
340 | 340 | ||
341 | static int ds1307_set_alarm(struct device *dev, struct rtc_wkalrm *t) | 341 | static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t) |
342 | { | 342 | { |
343 | struct i2c_client *client = to_i2c_client(dev); | 343 | struct i2c_client *client = to_i2c_client(dev); |
344 | struct ds1307 *ds1307 = i2c_get_clientdata(client); | 344 | struct ds1307 *ds1307 = i2c_get_clientdata(client); |
@@ -452,8 +452,8 @@ static int ds1307_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | |||
452 | static const struct rtc_class_ops ds13xx_rtc_ops = { | 452 | static const struct rtc_class_ops ds13xx_rtc_ops = { |
453 | .read_time = ds1307_get_time, | 453 | .read_time = ds1307_get_time, |
454 | .set_time = ds1307_set_time, | 454 | .set_time = ds1307_set_time, |
455 | .read_alarm = ds1307_read_alarm, | 455 | .read_alarm = ds1337_read_alarm, |
456 | .set_alarm = ds1307_set_alarm, | 456 | .set_alarm = ds1337_set_alarm, |
457 | .ioctl = ds1307_ioctl, | 457 | .ioctl = ds1307_ioctl, |
458 | }; | 458 | }; |
459 | 459 | ||
@@ -654,22 +654,6 @@ read_rtc: | |||
654 | break; | 654 | break; |
655 | } | 655 | } |
656 | 656 | ||
657 | tmp = ds1307->regs[DS1307_REG_SECS]; | ||
658 | tmp = bcd2bin(tmp & 0x7f); | ||
659 | if (tmp > 60) | ||
660 | goto exit_bad; | ||
661 | tmp = bcd2bin(ds1307->regs[DS1307_REG_MIN] & 0x7f); | ||
662 | if (tmp > 60) | ||
663 | goto exit_bad; | ||
664 | |||
665 | tmp = bcd2bin(ds1307->regs[DS1307_REG_MDAY] & 0x3f); | ||
666 | if (tmp == 0 || tmp > 31) | ||
667 | goto exit_bad; | ||
668 | |||
669 | tmp = bcd2bin(ds1307->regs[DS1307_REG_MONTH] & 0x1f); | ||
670 | if (tmp == 0 || tmp > 12) | ||
671 | goto exit_bad; | ||
672 | |||
673 | tmp = ds1307->regs[DS1307_REG_HOUR]; | 657 | tmp = ds1307->regs[DS1307_REG_HOUR]; |
674 | switch (ds1307->type) { | 658 | switch (ds1307->type) { |
675 | case ds_1340: | 659 | case ds_1340: |
@@ -726,13 +710,6 @@ read_rtc: | |||
726 | 710 | ||
727 | return 0; | 711 | return 0; |
728 | 712 | ||
729 | exit_bad: | ||
730 | dev_dbg(&client->dev, "%s: %02x %02x %02x %02x %02x %02x %02x\n", | ||
731 | "bogus register", | ||
732 | ds1307->regs[0], ds1307->regs[1], | ||
733 | ds1307->regs[2], ds1307->regs[3], | ||
734 | ds1307->regs[4], ds1307->regs[5], | ||
735 | ds1307->regs[6]); | ||
736 | exit_irq: | 713 | exit_irq: |
737 | if (ds1307->rtc) | 714 | if (ds1307->rtc) |
738 | rtc_device_unregister(ds1307->rtc); | 715 | rtc_device_unregister(ds1307->rtc); |