aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ds1307.c
diff options
context:
space:
mode:
authorJüri Reitel <juri.reitel@liewenthal.ee>2009-01-07 21:07:16 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-08 11:31:00 -0500
commit74d88eb2930f09e1a63d61cc9d4cffc50c684412 (patch)
tree70df7d4f1858f9509331341cc83159cae4586dcd /drivers/rtc/rtc-ds1307.c
parentfed40b734c343d4e4acf4b46f186bc3d69271867 (diff)
rtc-ds1307: remove legacy probe() checks
Remove RTC register value checks from the rtc-ds1307 probe() function. They were left over from the legacy style I2C driver, which had to defend against finding a non-RTC chip when the driver was probed. Also fix a minor glitch in the alarm support: DS1307 chips don't have alarms, so name those methods after one of the chips which actually *do* have alarms (DS1337). Signed-off-by: Jüri Reitel <juri.reitel@liewenthal.ee> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Cc: Sebastien Barre <sbarre@sdelcc.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Acked-by: Jean Delvare <khali@linux-fr.org> Cc: Rodolfo Giometti <giometti@enneenne.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-ds1307.c')
-rw-r--r--drivers/rtc/rtc-ds1307.c31
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
290static int ds1307_read_alarm(struct device *dev, struct rtc_wkalrm *t) 290static 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
341static int ds1307_set_alarm(struct device *dev, struct rtc_wkalrm *t) 341static 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)
452static const struct rtc_class_ops ds13xx_rtc_ops = { 452static 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
729exit_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]);
736exit_irq: 713exit_irq:
737 if (ds1307->rtc) 714 if (ds1307->rtc)
738 rtc_device_unregister(ds1307->rtc); 715 rtc_device_unregister(ds1307->rtc);