aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-m48t35.c
diff options
context:
space:
mode:
authorAlessandro Zummo <alessandro.zummo@towertech.it>2009-12-15 19:45:53 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 10:19:58 -0500
commitb74d2caa64f8e542e9c6716ae6ed4a60d681ea9f (patch)
tree3d34fb87043b4a800bd35455725ba81638541cc3 /drivers/rtc/rtc-m48t35.c
parentd1b2efa83fbf7b33919238fa29ef6ab935820103 (diff)
rtc: fix driver data issues in several rtc drivers
Herton Ronaldo Krzesinski recently raised up, and fixed, an issue with the rtc_cmos driver, which was referring to an inconsistent driver data. This patch ensures that driver data registration happens before rtc_device_register(). Signed-off-by: Alessandro Zummo <a.zummo@towertech.it> Acked-by: Thomas Hommel <thomas.hommel@gefanuc.com> Acked-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com> Acked-by: Paul Mundt <lethal@linux-sh.org> Cc: David S. Miller <davem@davemloft.net> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Andrew Sharp <andy.sharp@onstor.com> Cc: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Cc: Alexander Bigga <ab@mycable.de> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Mark Zhan <rongkai.zhan@windriver.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-m48t35.c')
-rw-r--r--drivers/rtc/rtc-m48t35.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-m48t35.c b/drivers/rtc/rtc-m48t35.c
index 0b2197559940..8cb5b8959e5b 100644
--- a/drivers/rtc/rtc-m48t35.c
+++ b/drivers/rtc/rtc-m48t35.c
@@ -142,7 +142,6 @@ static const struct rtc_class_ops m48t35_ops = {
142 142
143static int __devinit m48t35_probe(struct platform_device *pdev) 143static int __devinit m48t35_probe(struct platform_device *pdev)
144{ 144{
145 struct rtc_device *rtc;
146 struct resource *res; 145 struct resource *res;
147 struct m48t35_priv *priv; 146 struct m48t35_priv *priv;
148 int ret = 0; 147 int ret = 0;
@@ -171,20 +170,21 @@ static int __devinit m48t35_probe(struct platform_device *pdev)
171 ret = -ENOMEM; 170 ret = -ENOMEM;
172 goto out; 171 goto out;
173 } 172 }
173
174 spin_lock_init(&priv->lock); 174 spin_lock_init(&priv->lock);
175 rtc = rtc_device_register("m48t35", &pdev->dev, 175
176 platform_set_drvdata(pdev, priv);
177
178 priv->rtc = rtc_device_register("m48t35", &pdev->dev,
176 &m48t35_ops, THIS_MODULE); 179 &m48t35_ops, THIS_MODULE);
177 if (IS_ERR(rtc)) { 180 if (IS_ERR(priv->rtc)) {
178 ret = PTR_ERR(rtc); 181 ret = PTR_ERR(priv->rtc);
179 goto out; 182 goto out;
180 } 183 }
181 priv->rtc = rtc; 184
182 platform_set_drvdata(pdev, priv);
183 return 0; 185 return 0;
184 186
185out: 187out:
186 if (priv->rtc)
187 rtc_device_unregister(priv->rtc);
188 if (priv->reg) 188 if (priv->reg)
189 iounmap(priv->reg); 189 iounmap(priv->reg);
190 if (priv->baseaddr) 190 if (priv->baseaddr)