aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-x1205.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-x1205.c')
-rw-r--r--drivers/rtc/rtc-x1205.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
index 621d17afc0d9..788b6d1f8f2f 100644
--- a/drivers/rtc/rtc-x1205.c
+++ b/drivers/rtc/rtc-x1205.c
@@ -19,7 +19,7 @@
19#include <linux/rtc.h> 19#include <linux/rtc.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21 21
22#define DRV_VERSION "1.0.6" 22#define DRV_VERSION "1.0.7"
23 23
24/* Addresses to scan: none. This chip is located at 24/* Addresses to scan: none. This chip is located at
25 * 0x6f and uses a two bytes register addressing. 25 * 0x6f and uses a two bytes register addressing.
@@ -451,8 +451,6 @@ static int x1205_rtc_proc(struct device *dev, struct seq_file *seq)
451{ 451{
452 int err, dtrim, atrim; 452 int err, dtrim, atrim;
453 453
454 seq_printf(seq, "24hr\t\t: yes\n");
455
456 if ((err = x1205_get_dtrim(to_i2c_client(dev), &dtrim)) == 0) 454 if ((err = x1205_get_dtrim(to_i2c_client(dev), &dtrim)) == 0)
457 seq_printf(seq, "digital_trim\t: %d ppm\n", dtrim); 455 seq_printf(seq, "digital_trim\t: %d ppm\n", dtrim);
458 456
@@ -473,30 +471,31 @@ static struct rtc_class_ops x1205_rtc_ops = {
473static ssize_t x1205_sysfs_show_atrim(struct device *dev, 471static ssize_t x1205_sysfs_show_atrim(struct device *dev,
474 struct device_attribute *attr, char *buf) 472 struct device_attribute *attr, char *buf)
475{ 473{
476 int atrim; 474 int err, atrim;
477 475
478 if (x1205_get_atrim(to_i2c_client(dev), &atrim) == 0) 476 err = x1205_get_atrim(to_i2c_client(dev), &atrim);
479 return sprintf(buf, "%d.%02d pF\n", 477 if (err)
480 atrim / 1000, atrim % 1000); 478 return err;
481 return 0; 479
480 return sprintf(buf, "%d.%02d pF\n", atrim / 1000, atrim % 1000);
482} 481}
483static DEVICE_ATTR(atrim, S_IRUGO, x1205_sysfs_show_atrim, NULL); 482static DEVICE_ATTR(atrim, S_IRUGO, x1205_sysfs_show_atrim, NULL);
484 483
485static ssize_t x1205_sysfs_show_dtrim(struct device *dev, 484static ssize_t x1205_sysfs_show_dtrim(struct device *dev,
486 struct device_attribute *attr, char *buf) 485 struct device_attribute *attr, char *buf)
487{ 486{
488 int dtrim; 487 int err, dtrim;
489 488
490 if (x1205_get_dtrim(to_i2c_client(dev), &dtrim) == 0) 489 err = x1205_get_dtrim(to_i2c_client(dev), &dtrim);
491 return sprintf(buf, "%d ppm\n", dtrim); 490 if (err)
491 return err;
492 492
493 return 0; 493 return sprintf(buf, "%d ppm\n", dtrim);
494} 494}
495static DEVICE_ATTR(dtrim, S_IRUGO, x1205_sysfs_show_dtrim, NULL); 495static DEVICE_ATTR(dtrim, S_IRUGO, x1205_sysfs_show_dtrim, NULL);
496 496
497static int x1205_attach(struct i2c_adapter *adapter) 497static int x1205_attach(struct i2c_adapter *adapter)
498{ 498{
499 dev_dbg(&adapter->dev, "%s\n", __FUNCTION__);
500 return i2c_probe(adapter, &addr_data, x1205_probe); 499 return i2c_probe(adapter, &addr_data, x1205_probe);
501} 500}
502 501
@@ -545,8 +544,6 @@ static int x1205_probe(struct i2c_adapter *adapter, int address, int kind)
545 544
546 if (IS_ERR(rtc)) { 545 if (IS_ERR(rtc)) {
547 err = PTR_ERR(rtc); 546 err = PTR_ERR(rtc);
548 dev_err(&client->dev,
549 "unable to register the class device\n");
550 goto exit_detach; 547 goto exit_detach;
551 } 548 }
552 549
@@ -585,8 +582,6 @@ static int x1205_detach(struct i2c_client *client)
585 int err; 582 int err;
586 struct rtc_device *rtc = i2c_get_clientdata(client); 583 struct rtc_device *rtc = i2c_get_clientdata(client);
587 584
588 dev_dbg(&client->dev, "%s\n", __FUNCTION__);
589
590 if (rtc) 585 if (rtc)
591 rtc_device_unregister(rtc); 586 rtc_device_unregister(rtc);
592 587