aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-m48t35.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-m48t35.c')
-rw-r--r--drivers/rtc/rtc-m48t35.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-m48t35.c b/drivers/rtc/rtc-m48t35.c
index 0b2197559940..7410875e5838 100644
--- a/drivers/rtc/rtc-m48t35.c
+++ b/drivers/rtc/rtc-m48t35.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/rtc.h> 18#include <linux/rtc.h>
19#include <linux/slab.h>
19#include <linux/platform_device.h> 20#include <linux/platform_device.h>
20#include <linux/bcd.h> 21#include <linux/bcd.h>
21#include <linux/io.h> 22#include <linux/io.h>
@@ -142,7 +143,6 @@ static const struct rtc_class_ops m48t35_ops = {
142 143
143static int __devinit m48t35_probe(struct platform_device *pdev) 144static int __devinit m48t35_probe(struct platform_device *pdev)
144{ 145{
145 struct rtc_device *rtc;
146 struct resource *res; 146 struct resource *res;
147 struct m48t35_priv *priv; 147 struct m48t35_priv *priv;
148 int ret = 0; 148 int ret = 0;
@@ -171,20 +171,21 @@ static int __devinit m48t35_probe(struct platform_device *pdev)
171 ret = -ENOMEM; 171 ret = -ENOMEM;
172 goto out; 172 goto out;
173 } 173 }
174
174 spin_lock_init(&priv->lock); 175 spin_lock_init(&priv->lock);
175 rtc = rtc_device_register("m48t35", &pdev->dev, 176
177 platform_set_drvdata(pdev, priv);
178
179 priv->rtc = rtc_device_register("m48t35", &pdev->dev,
176 &m48t35_ops, THIS_MODULE); 180 &m48t35_ops, THIS_MODULE);
177 if (IS_ERR(rtc)) { 181 if (IS_ERR(priv->rtc)) {
178 ret = PTR_ERR(rtc); 182 ret = PTR_ERR(priv->rtc);
179 goto out; 183 goto out;
180 } 184 }
181 priv->rtc = rtc; 185
182 platform_set_drvdata(pdev, priv);
183 return 0; 186 return 0;
184 187
185out: 188out:
186 if (priv->rtc)
187 rtc_device_unregister(priv->rtc);
188 if (priv->reg) 189 if (priv->reg)
189 iounmap(priv->reg); 190 iounmap(priv->reg);
190 if (priv->baseaddr) 191 if (priv->baseaddr)