diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2006-10-01 08:28:18 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 09:39:25 +0200 |
commit | 391b1fe67d193df75144a92b146613c36491ef0d (patch) | |
tree | ea455c0b5b2ed29cf11a33ffecc85d58851d2ab7 /drivers/rtc/rtc-ds1742.c | |
parent | [PATCH] AT91rm9200 RTC can issue system wakeup events (diff) | |
download | linux-391b1fe67d193df75144a92b146613c36491ef0d.tar.xz linux-391b1fe67d193df75144a92b146613c36491ef0d.zip |
[PATCH] RTC: rtc-ds1553, rtc-ds1742 update
Check return value of sysfs_create_bin_file(). Fix polarity of
RTC_BATT_FLAG bit in DS1742.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/rtc/rtc-ds1742.c')
-rw-r--r-- | drivers/rtc/rtc-ds1742.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index 01da5ab15fbc..6273a3d240a2 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c @@ -17,7 +17,7 @@ #include <linux/platform_device.h> #include <linux/io.h> -#define DRV_VERSION "0.1" +#define DRV_VERSION "0.2" #define RTC_REG_SIZE 0x800 #define RTC_OFFSET 0x7f8 @@ -196,7 +196,7 @@ static int __init ds1742_rtc_probe(struct platform_device *pdev) writeb(sec, ioaddr + RTC_SECONDS); writeb(cen & RTC_CENTURY_MASK, ioaddr + RTC_CONTROL); } - if (readb(ioaddr + RTC_DAY) & RTC_BATT_FLAG) + if (!(readb(ioaddr + RTC_DAY) & RTC_BATT_FLAG)) dev_warn(&pdev->dev, "voltage-low detected.\n"); rtc = rtc_device_register(pdev->name, &pdev->dev, @@ -208,9 +208,13 @@ static int __init ds1742_rtc_probe(struct platform_device *pdev) pdata->rtc = rtc; pdata->last_jiffies = jiffies; platform_set_drvdata(pdev, pdata); - sysfs_create_bin_file(&pdev->dev.kobj, &ds1742_nvram_attr); + ret = sysfs_create_bin_file(&pdev->dev.kobj, &ds1742_nvram_attr); + if (ret) + goto out; return 0; out: + if (pdata->rtc) + rtc_device_unregister(pdata->rtc); if (ioaddr) iounmap(ioaddr); if (pdata->baseaddr) |