rtc: rtc-pm8058: port driver to 3.0
The pm_chip pointer comes from the parent, so use that rather
than the local drvdata when probing.
In addition, in 3.0, upon registration Linux will immediately
call back into the driver. Therefore we must register the local
rtc driver data with the driver data *before* registering.
With this change the rtc_test test passes.
Change-Id: I1310f6eec1015d26b919907e430c715efe5c1091
Signed-off-by: Michael Bohan <mbohan@codeaurora.org>
diff --git a/drivers/rtc/rtc-pm8058.c b/drivers/rtc/rtc-pm8058.c
index d8b350b..0376c64 100644
--- a/drivers/rtc/rtc-pm8058.c
+++ b/drivers/rtc/rtc-pm8058.c
@@ -390,7 +390,7 @@
struct pm8058_rtc *rtc_dd;
struct pm8058_chip *pm_chip;
- pm_chip = platform_get_drvdata(pdev);
+ pm_chip = dev_get_drvdata(pdev->dev.parent);
if (pm_chip == NULL) {
pr_err("%s: Invalid driver information\n", __func__);
return -ENXIO;
@@ -456,6 +456,8 @@
pm8058_rtc0_ops.set_time = pm8058_rtc0_set_time;
#endif
+ platform_set_drvdata(pdev, rtc_dd);
+
/* Register the RTC device */
rtc_dd->rtc0 = rtc_device_register("pm8058_rtc0", &pdev->dev,
&pm8058_rtc0_ops, THIS_MODULE);
@@ -466,8 +468,6 @@
goto fail_rtc_enable;
}
- platform_set_drvdata(pdev, rtc_dd);
-
/* Request the alarm IRQ */
rc = request_threaded_irq(rtc_dd->rtc_alarm_irq, NULL,
pm8058_alarm_trigger, IRQF_TRIGGER_RISING,