aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-mrst.c
diff options
context:
space:
mode:
authorFeng Tang <feng.tang@intel.com>2011-04-06 21:39:44 -0400
committerIngo Molnar <mingo@elte.hu>2011-04-07 05:27:42 -0400
commitde97a21a23dda34f1754a748560dede139e6bfc2 (patch)
tree7d6300b10d5b105c39e8d2857075a646a242a974 /drivers/rtc/rtc-mrst.c
parent6221f222c0ebf1acdf7abcf927178f40e1a65e2a (diff)
rtc, x86/mrst/vrtc: Fix boot crash in rtc_read_alarm()
Commit f44f7f96a20 ("RTC: Initialize kernel state from RTC") caused a boot regression on the MRST platform. The reason is that rtc_device_register() calls rtc_read_alarm() after that change, which function does not have all driver data set up yet. The rtc-mrst driver needs to call dev_set_drvdata() before rtc_device_register() gets called. Signed-off-by: Feng Tang <feng.tang@intel.com> Signed-off-by: Alan Cox <alan@linux.intel.com> Acked-by: John Stultz <john.stultz@linaro.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: http://lkml.kernel.org/r/1302140384-27571-1-git-send-email-feng.tang@intel.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/rtc/rtc-mrst.c')
-rw-r--r--drivers/rtc/rtc-mrst.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c
index 332a2c4a891c..b2f096871a97 100644
--- a/drivers/rtc/rtc-mrst.c
+++ b/drivers/rtc/rtc-mrst.c
@@ -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;