linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: anarsoul@gmail.com (Vasily Khoruzhick)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] rtc-s3c: Fix rtc-s3c driver initialization
Date: Thu, 27 May 2010 18:57:26 +0300	[thread overview]
Message-ID: <1274975846-14006-1-git-send-email-anarsoul@gmail.com> (raw)

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.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 drivers/rtc/rtc-s3c.c |   29 +++++++++++++----------------
 1 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index e5972b2..dc2081f 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -488,19 +488,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 		goto err_nomap;
 	}
 
-	/* check to see if everything is setup correctly */
-
-	s3c_rtc_enable(pdev, 1);
-
- 	pr_debug("s3c2410_rtc: RTCCON=%02x\n",
-		 readb(s3c_rtc_base + S3C2410_RTCCON));
-
-	s3c_rtc_setfreq(&pdev->dev, 1);
-
-	device_init_wakeup(&pdev->dev, 1);
-
-	/* register RTC and exit */
-
+	/* Register rtc and check to see if everything is setup correctly */
 	rtc = rtc_device_register("s3c", &pdev->dev, &s3c_rtcops,
 				  THIS_MODULE);
 
@@ -510,18 +498,27 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
 		goto err_nortc;
 	}
 
+	platform_set_drvdata(pdev, rtc);
+
+	s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
+
 	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;
+	s3c_rtc_enable(pdev, 1);
+
+	pr_debug("s3c2410_rtc: RTCCON=%02x\n",
+		 readb(s3c_rtc_base + S3C2410_RTCCON));
+
+	s3c_rtc_setfreq(&pdev->dev, 1);
+
+	device_init_wakeup(&pdev->dev, 1);
 
-	platform_set_drvdata(pdev, rtc);
 	return 0;
 
  err_nortc:
-	s3c_rtc_enable(pdev, 0);
 	iounmap(s3c_rtc_base);
 
  err_nomap:
-- 
1.7.1

             reply	other threads:[~2010-05-27 15:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-27 15:57 Vasily Khoruzhick [this message]
2010-06-14  6:04 ` [PATCH v2] rtc-s3c: Fix rtc-s3c driver initialization Vasily Khoruzhick
2010-06-14 10:18   ` Maurus Cuelenaere
2010-06-14 10:38     ` Vasily Khoruzhick
2010-06-14 10:44       ` Maurus Cuelenaere

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1274975846-14006-1-git-send-email-anarsoul@gmail.com \
    --to=anarsoul@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).