Commit 391b1fe6 authored by Atsushi Nemoto's avatar Atsushi Nemoto Committed by Linus Torvalds

[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: default avatarAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 90b4d648
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
#define DRV_VERSION "0.1" #define DRV_VERSION "0.2"
#define RTC_REG_SIZE 0x2000 #define RTC_REG_SIZE 0x2000
#define RTC_OFFSET 0x1ff0 #define RTC_OFFSET 0x1ff0
...@@ -357,9 +357,13 @@ static int __init ds1553_rtc_probe(struct platform_device *pdev) ...@@ -357,9 +357,13 @@ static int __init ds1553_rtc_probe(struct platform_device *pdev)
pdata->rtc = rtc; pdata->rtc = rtc;
pdata->last_jiffies = jiffies; pdata->last_jiffies = jiffies;
platform_set_drvdata(pdev, pdata); platform_set_drvdata(pdev, pdata);
sysfs_create_bin_file(&pdev->dev.kobj, &ds1553_nvram_attr); ret = sysfs_create_bin_file(&pdev->dev.kobj, &ds1553_nvram_attr);
if (ret)
goto out;
return 0; return 0;
out: out:
if (pdata->rtc)
rtc_device_unregister(pdata->rtc);
if (pdata->irq >= 0) if (pdata->irq >= 0)
free_irq(pdata->irq, pdev); free_irq(pdata->irq, pdev);
if (ioaddr) if (ioaddr)
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
#define DRV_VERSION "0.1" #define DRV_VERSION "0.2"
#define RTC_REG_SIZE 0x800 #define RTC_REG_SIZE 0x800
#define RTC_OFFSET 0x7f8 #define RTC_OFFSET 0x7f8
...@@ -196,7 +196,7 @@ static int __init ds1742_rtc_probe(struct platform_device *pdev) ...@@ -196,7 +196,7 @@ static int __init ds1742_rtc_probe(struct platform_device *pdev)
writeb(sec, ioaddr + RTC_SECONDS); writeb(sec, ioaddr + RTC_SECONDS);
writeb(cen & RTC_CENTURY_MASK, ioaddr + RTC_CONTROL); 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"); dev_warn(&pdev->dev, "voltage-low detected.\n");
rtc = rtc_device_register(pdev->name, &pdev->dev, rtc = rtc_device_register(pdev->name, &pdev->dev,
...@@ -208,9 +208,13 @@ static int __init ds1742_rtc_probe(struct platform_device *pdev) ...@@ -208,9 +208,13 @@ static int __init ds1742_rtc_probe(struct platform_device *pdev)
pdata->rtc = rtc; pdata->rtc = rtc;
pdata->last_jiffies = jiffies; pdata->last_jiffies = jiffies;
platform_set_drvdata(pdev, pdata); 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; return 0;
out: out:
if (pdata->rtc)
rtc_device_unregister(pdata->rtc);
if (ioaddr) if (ioaddr)
iounmap(ioaddr); iounmap(ioaddr);
if (pdata->baseaddr) if (pdata->baseaddr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment