Skip to contentSkip to conversation

rtc-s3c: Fix rtc-s3c driver initialization

PATCH New Vasily Khoruzhick 1 participant 2 messages May 27, 2010 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc-s3c: Fix rtc-s3c driver initialization

setfreq should be called only after rtc device registration, as it uses rtc device; s3c_rtc_cpu_type should be checked only once it was set.

---
 drivers/rtc/rtc-s3c.c |   28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 deletions(-)
drivers/rtc/rtc-s3c.c +13 -15
index e5972b2..6b47f53 100644
@@ -488,7 +488,19 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 		goto err_nomap;
 	}
 
-	/* check to see if everything is setup correctly */
+	/* Register rtc and check to see if everything is setup correctly */
+	rtc = rtc_device_register("s3c", &pdev->dev, &s3c_rtcops,
+				  THIS_MODULE);
+
+	if (IS_ERR(rtc)) {
+		dev_err(&pdev->dev, "cannot attach rtc\n");
+		ret = PTR_ERR(rtc);
+		goto err_nortc;
+	}
+
+	s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
+
+	platform_set_drvdata(pdev, rtc);
 
 	s3c_rtc_enable(pdev, 1);
 
@@ -499,25 +511,11 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 
 	device_init_wakeup(&pdev->dev, 1);
 
-	/* register RTC and exit */
-
-	rtc = rtc_device_register("s3c", &pdev->dev, &s3c_rtcops,
-				  THIS_MODULE);
-
-	if (IS_ERR(rtc)) {
-		dev_err(&pdev->dev, "cannot attach rtc\n");
-		ret = PTR_ERR(rtc);
-		goto err_nortc;
-	}
-
 	if (s3c_rtc_cpu_type == TYPE_S3C64XX)
 		rtc->max_user_freq = 32768;
 	else
 		rtc->max_user_freq = 128;
 
-	s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
-
-	platform_set_drvdata(pdev, rtc);
 	return 0;
 
  err_nortc:
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 rtc-s3c: Fix rtc-s3c driver initialization

? ????????? ?? 27 ??? 2010 17:48:29 ????? Vasily Khoruzhick ???????:

Quoted 3 lines

setfreq should be called only after rtc device registration, as it uses rtc device; s3c_rtc_cpu_type should be checked only once it was set.

Discard this patch, max_user_freq is still set after first setfreq call. Will resend fixed version soon.

Regards
Vasily
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100527/99e46476/attachment.sig>