[PATCH 2/3] alarmtimer: Using the alarmtimer_get_rtcdev for allposix clock interface

From: Chuansheng Liu
Date: Wed Oct 31 2012 - 03:22:31 EST



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

Signed-off-by: liu chuansheng <chuansheng.liu@xxxxxxxxx>
---
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



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/