aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorWan ZongShun <mcuos.com@gmail.com>2010-08-10 21:02:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-11 11:59:08 -0400
commit23e53be94a7bf9220e1e3d8b0b56b8c96cb88e3c (patch)
treee43b774742d66f73f06da43c08182253b32b6bc2 /drivers/rtc
parent84f20a6928bb2b8e5f7ab50686bdf1566479363a (diff)
rtc/nuc900: modify enable/disable IRQs and driver data setting location
This patch does two modifications: (1) Adjust enable/disable IRQs location,enable it after rtc registration and disable it prior to unregistration. (2) Put 'platform_set_drvdata(pdev, nuc900_rtc)' in front of rtc registration still be safety, though there is no need to do this, when I move enable irq after rtc registration, I think still put 'platform_set_drvdata' before rtc registration that would be a good habit. Signed-off-by: Wan ZongShun <mcuos.com@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-nuc900.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/rtc/rtc-nuc900.c b/drivers/rtc/rtc-nuc900.c
index 84336d170a38..0267ea3b0f67 100644
--- a/drivers/rtc/rtc-nuc900.c
+++ b/drivers/rtc/rtc-nuc900.c
@@ -269,29 +269,30 @@ static int __devinit nuc900_rtc_probe(struct platform_device *pdev)
269 goto fail2; 269 goto fail2;
270 } 270 }
271 271
272 nuc900_rtc->irq_num = platform_get_irq(pdev, 0); 272 platform_set_drvdata(pdev, nuc900_rtc);
273 if (request_irq(nuc900_rtc->irq_num, nuc900_rtc_interrupt,
274 IRQF_DISABLED, "nuc900rtc", nuc900_rtc)) {
275 dev_err(&pdev->dev, "NUC900 RTC request irq failed\n");
276 err = -EBUSY;
277 goto fail3;
278 }
279 273
280 nuc900_rtc->rtcdev = rtc_device_register(pdev->name, &pdev->dev, 274 nuc900_rtc->rtcdev = rtc_device_register(pdev->name, &pdev->dev,
281 &nuc900_rtc_ops, THIS_MODULE); 275 &nuc900_rtc_ops, THIS_MODULE);
282 if (IS_ERR(nuc900_rtc->rtcdev)) { 276 if (IS_ERR(nuc900_rtc->rtcdev)) {
283 dev_err(&pdev->dev, "rtc device register faild\n"); 277 dev_err(&pdev->dev, "rtc device register faild\n");
284 err = PTR_ERR(nuc900_rtc->rtcdev); 278 err = PTR_ERR(nuc900_rtc->rtcdev);
285 goto fail4; 279 goto fail3;
286 } 280 }
287 281
288 platform_set_drvdata(pdev, nuc900_rtc);
289 __raw_writel(__raw_readl(nuc900_rtc->rtc_reg + REG_RTC_TSSR) | MODE24, 282 __raw_writel(__raw_readl(nuc900_rtc->rtc_reg + REG_RTC_TSSR) | MODE24,
290 nuc900_rtc->rtc_reg + REG_RTC_TSSR); 283 nuc900_rtc->rtc_reg + REG_RTC_TSSR);
291 284
285 nuc900_rtc->irq_num = platform_get_irq(pdev, 0);
286 if (request_irq(nuc900_rtc->irq_num, nuc900_rtc_interrupt,
287 IRQF_DISABLED, "nuc900rtc", nuc900_rtc)) {
288 dev_err(&pdev->dev, "NUC900 RTC request irq failed\n");
289 err = -EBUSY;
290 goto fail4;
291 }
292
292 return 0; 293 return 0;
293 294
294fail4: free_irq(nuc900_rtc->irq_num, nuc900_rtc); 295fail4: rtc_device_unregister(nuc900_rtc->rtcdev);
295fail3: iounmap(nuc900_rtc->rtc_reg); 296fail3: iounmap(nuc900_rtc->rtc_reg);
296fail2: release_mem_region(res->start, resource_size(res)); 297fail2: release_mem_region(res->start, resource_size(res));
297fail1: kfree(nuc900_rtc); 298fail1: kfree(nuc900_rtc);
@@ -303,8 +304,8 @@ static int __devexit nuc900_rtc_remove(struct platform_device *pdev)
303 struct nuc900_rtc *nuc900_rtc = platform_get_drvdata(pdev); 304 struct nuc900_rtc *nuc900_rtc = platform_get_drvdata(pdev);
304 struct resource *res; 305 struct resource *res;
305 306
306 rtc_device_unregister(nuc900_rtc->rtcdev);
307 free_irq(nuc900_rtc->irq_num, nuc900_rtc); 307 free_irq(nuc900_rtc->irq_num, nuc900_rtc);
308 rtc_device_unregister(nuc900_rtc->rtcdev);
308 iounmap(nuc900_rtc->rtc_reg); 309 iounmap(nuc900_rtc->rtc_reg);
309 310
310 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 311 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);