aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-mrst.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-mrst.c')
-rw-r--r--drivers/rtc/rtc-mrst.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c
index b86bc328463b..b2f096871a97 100644
--- a/drivers/rtc/rtc-mrst.c
+++ b/drivers/rtc/rtc-mrst.c
@@ -319,7 +319,7 @@ static irqreturn_t mrst_rtc_irq(int irq, void *p)
319 return IRQ_NONE; 319 return IRQ_NONE;
320} 320}
321 321
322static int __init 322static int __devinit
323vrtc_mrst_do_probe(struct device *dev, struct resource *iomem, int rtc_irq) 323vrtc_mrst_do_probe(struct device *dev, struct resource *iomem, int rtc_irq)
324{ 324{
325 int retval = 0; 325 int retval = 0;
@@ -342,6 +342,8 @@ vrtc_mrst_do_probe(struct device *dev, struct resource *iomem, int rtc_irq)
342 342
343 mrst_rtc.irq = rtc_irq; 343 mrst_rtc.irq = rtc_irq;
344 mrst_rtc.iomem = iomem; 344 mrst_rtc.iomem = iomem;
345 mrst_rtc.dev = dev;
346 dev_set_drvdata(dev, &mrst_rtc);
345 347
346 mrst_rtc.rtc = rtc_device_register(driver_name, dev, 348 mrst_rtc.rtc = rtc_device_register(driver_name, dev,
347 &mrst_rtc_ops, THIS_MODULE); 349 &mrst_rtc_ops, THIS_MODULE);
@@ -350,8 +352,6 @@ vrtc_mrst_do_probe(struct device *dev, struct resource *iomem, int rtc_irq)
350 goto cleanup0; 352 goto cleanup0;
351 } 353 }
352 354
353 mrst_rtc.dev = dev;
354 dev_set_drvdata(dev, &mrst_rtc);
355 rename_region(iomem, dev_name(&mrst_rtc.rtc->dev)); 355 rename_region(iomem, dev_name(&mrst_rtc.rtc->dev));
356 356
357 spin_lock_irq(&rtc_lock); 357 spin_lock_irq(&rtc_lock);
@@ -376,9 +376,10 @@ vrtc_mrst_do_probe(struct device *dev, struct resource *iomem, int rtc_irq)
376 return 0; 376 return 0;
377 377
378cleanup1: 378cleanup1:
379 mrst_rtc.dev = NULL;
380 rtc_device_unregister(mrst_rtc.rtc); 379 rtc_device_unregister(mrst_rtc.rtc);
381cleanup0: 380cleanup0:
381 dev_set_drvdata(dev, NULL);
382 mrst_rtc.dev = NULL;
382 release_region(iomem->start, iomem->end + 1 - iomem->start); 383 release_region(iomem->start, iomem->end + 1 - iomem->start);
383 dev_err(dev, "rtc-mrst: unable to initialise\n"); 384 dev_err(dev, "rtc-mrst: unable to initialise\n");
384 return retval; 385 return retval;
@@ -391,7 +392,7 @@ static void rtc_mrst_do_shutdown(void)
391 spin_unlock_irq(&rtc_lock); 392 spin_unlock_irq(&rtc_lock);
392} 393}
393 394
394static void __exit rtc_mrst_do_remove(struct device *dev) 395static void __devexit rtc_mrst_do_remove(struct device *dev)
395{ 396{
396 struct mrst_rtc *mrst = dev_get_drvdata(dev); 397 struct mrst_rtc *mrst = dev_get_drvdata(dev);
397 struct resource *iomem; 398 struct resource *iomem;
@@ -500,14 +501,14 @@ static inline int mrst_poweroff(struct device *dev)
500 501
501#endif 502#endif
502 503
503static int __init vrtc_mrst_platform_probe(struct platform_device *pdev) 504static int __devinit vrtc_mrst_platform_probe(struct platform_device *pdev)
504{ 505{
505 return vrtc_mrst_do_probe(&pdev->dev, 506 return vrtc_mrst_do_probe(&pdev->dev,
506 platform_get_resource(pdev, IORESOURCE_MEM, 0), 507 platform_get_resource(pdev, IORESOURCE_MEM, 0),
507 platform_get_irq(pdev, 0)); 508 platform_get_irq(pdev, 0));
508} 509}
509 510
510static int __exit vrtc_mrst_platform_remove(struct platform_device *pdev) 511static int __devexit vrtc_mrst_platform_remove(struct platform_device *pdev)
511{ 512{
512 rtc_mrst_do_remove(&pdev->dev); 513 rtc_mrst_do_remove(&pdev->dev);
513 return 0; 514 return 0;
@@ -525,7 +526,7 @@ MODULE_ALIAS("platform:vrtc_mrst");
525 526
526static struct platform_driver vrtc_mrst_platform_driver = { 527static struct platform_driver vrtc_mrst_platform_driver = {
527 .probe = vrtc_mrst_platform_probe, 528 .probe = vrtc_mrst_platform_probe,
528 .remove = __exit_p(vrtc_mrst_platform_remove), 529 .remove = __devexit_p(vrtc_mrst_platform_remove),
529 .shutdown = vrtc_mrst_platform_shutdown, 530 .shutdown = vrtc_mrst_platform_shutdown,
530 .driver = { 531 .driver = {
531 .name = (char *) driver_name, 532 .name = (char *) driver_name,