mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chuansheng Liu <chuansheng.liu@intel.com>
To: john.stultz@linaro.org, tglx@linutronix.de, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, chuansheng.liu@intel.com
Subject: [PATCH 2/3] alarmtimer: Using the alarmtimer_get_rtcdev for all posix clock interface
Date: Thu, 01 Nov 2012 00:23:03 +0800	[thread overview]
Message-ID: <1351700583.15558.1573.camel@cliu38-desktop-build> (raw)
In-Reply-To: <1351700455.15558.1571.camel@cliu38-desktop-build>


Some posix clock interface directly use the variable rtcdev,
cleanup it here by alarmtimer_get_rtcdev().

Signed-off-by: liu chuansheng <chuansheng.liu@intel.com>
---
 kernel/time/alarmtimer.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 4fc17cb..5490fa8 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -86,11 +86,10 @@ static int alarmtimer_rtc_add_device(struct device *dev,
 		return -1;
 
 	mutex_lock(&rtcdev_mutex);
-	if (!rtcdev) {
-		rtcdev = rtc;
-		/* hold a reference so it doesn't go away */
-		get_device(dev);
-	}
+	rtcdev = rtc;
+	/* hold a reference so it doesn't go away */
+	get_device(dev);
+
 	mutex_unlock(&rtcdev_mutex);
 	return 0;
 }
@@ -516,7 +515,7 @@ static void alarm_timer_get(struct k_itimer *timr,
  */
 static int alarm_timer_del(struct k_itimer *timr)
 {
-	if (!rtcdev)
+	if (!alarmtimer_get_rtcdev())
 		return -ENOTSUPP;
 
 	if (alarm_try_to_cancel(&timr->it.alarm.alarmtimer) < 0)
@@ -538,7 +537,7 @@ static int alarm_timer_set(struct k_itimer *timr, int flags,
 				struct itimerspec *new_setting,
 				struct itimerspec *old_setting)
 {
-	if (!rtcdev)
+	if (!alarmtimer_get_rtcdev())
 		return -ENOTSUPP;
 
 	if (old_setting)
-- 
1.7.0.4




  parent reply	other threads:[~2012-10-31  7:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 16:20 [PATCH 1/3] alarmtimer: Replace the spinlock rtcdev_lock with mutex Chuansheng Liu
2012-10-31  9:03 ` Oliver Neukum
2012-11-01  0:02   ` Liu, Chuansheng
2012-11-01 22:43     ` Thomas Gleixner
2012-11-02  3:32       ` Liu, Chuansheng
2012-10-31 16:23 ` Chuansheng Liu [this message]
2012-11-01 22:55   ` [PATCH 2/3] alarmtimer: Using the alarmtimer_get_rtcdev for all posix clock interface Thomas Gleixner
2012-11-02  3:41     ` Liu, Chuansheng
2012-11-02  6:10     ` Liu, Chuansheng
2012-10-31 16:25 ` [PATCH 3/3] alarmtimer: cleanup the POSIX clock interface without CONFIG_RTC_CLASS Chuansheng Liu

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=1351700583.15558.1573.camel@cliu38-desktop-build \
    --to=chuansheng.liu@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®