lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1351700704.15558.1575.camel@cliu38-desktop-build>
Date:	Thu, 01 Nov 2012 00:25:04 +0800
From:	Chuansheng Liu <chuansheng.liu@...el.com>
To:	john.stultz@...aro.org, tglx@...utronix.de,
	gregkh@...uxfoundation.org
Cc:	linux-kernel@...r.kernel.org, chuansheng.liu@...el.com
Subject: [PATCH 3/3] alarmtimer: cleanup the POSIX clock interface without
 CONFIG_RTC_CLASS


When CONFIG_RTC_CLASS is not defined, implementing the POSIX clock
interface with null function is enough.

Signed-off-by: liu chuansheng <chuansheng.liu@...el.com>
---
 kernel/time/alarmtimer.c |   78 ++++++++++++++++++++++++++++++++++-----------
 1 files changed, 59 insertions(+), 19 deletions(-)

diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 5490fa8..12c17a4 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -41,10 +41,6 @@ static struct alarm_base {
 	clockid_t		base_clockid;
 } alarm_bases[ALARM_NUMTYPE];
 
-/* freezer delta & lock used to handle clock_nanosleep triggered wakeups */
-static ktime_t freezer_delta;
-static DEFINE_SPINLOCK(freezer_delta_lock);
-
 static struct wakeup_source *ws;
 
 #ifdef CONFIG_RTC_CLASS
@@ -53,6 +49,10 @@ static struct rtc_timer		rtctimer;
 static struct rtc_device	*rtcdev;
 static DEFINE_MUTEX(rtcdev_mutex);
 
+/* freezer delta & lock used to handle clock_nanosleep triggered wakeups */
+static ktime_t freezer_delta;
+static DEFINE_SPINLOCK(freezer_delta_lock);
+
 /**
  * alarmtimer_get_rtcdev - Return selected rtcdevice
  *
@@ -268,21 +268,6 @@ static int alarmtimer_suspend(struct device *dev)
 }
 #endif
 
-static void alarmtimer_freezerset(ktime_t absexp, enum alarmtimer_type type)
-{
-	ktime_t delta;
-	unsigned long flags;
-	struct alarm_base *base = &alarm_bases[type];
-
-	delta = ktime_sub(absexp, base->gettime());
-
-	spin_lock_irqsave(&freezer_delta_lock, flags);
-	if (!freezer_delta.tv64 || (delta.tv64 < freezer_delta.tv64))
-		freezer_delta = delta;
-	spin_unlock_irqrestore(&freezer_delta_lock, flags);
-}
-
-
 /**
  * alarm_init - Initialize an alarm structure
  * @alarm: ptr to alarm to be initialized
@@ -393,6 +378,21 @@ u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval)
 
 
 
+#ifdef CONFIG_RTC_CLASS
+static void alarmtimer_freezerset(ktime_t absexp, enum alarmtimer_type type)
+{
+	ktime_t delta;
+	unsigned long flags;
+	struct alarm_base *base = &alarm_bases[type];
+
+	delta = ktime_sub(absexp, base->gettime());
+
+	spin_lock_irqsave(&freezer_delta_lock, flags);
+	if (!freezer_delta.tv64 || (delta.tv64 < freezer_delta.tv64))
+		freezer_delta = delta;
+	spin_unlock_irqrestore(&freezer_delta_lock, flags);
+}
+
 
 /**
  * clock2alarm - helper that converts from clockid to alarmtypes
@@ -722,7 +722,47 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
 out:
 	return ret;
 }
+#else
+static inline int alarm_clock_getres(const clockid_t which_clock,
+						struct timespec *tp)
+{
+	return 0;
+}
+
+static inline int alarm_clock_get(clockid_t which_clock, struct timespec *tp)
+{
+	return 0;
+}
 
+static inline int alarm_timer_create(struct k_itimer *new_timer)
+{
+	return 0;
+}
+
+static inline int alarm_timer_set(struct k_itimer *timr, int flags,
+				struct itimerspec *new_setting,
+				struct itimerspec *old_setting)
+{
+	return 0;
+}
+
+static inline int alarm_timer_del(struct k_itimer *timr)
+{
+	return 0;
+}
+
+static inline void alarm_timer_get(struct k_itimer *timr,
+				struct itimerspec *cur_setting)
+{
+	return;
+}
+
+static inline int alarm_timer_nsleep(const clockid_t which_clock, int flags,
+		     struct timespec *tsreq, struct timespec __user *rmtp)
+{
+	return 0;
+}
+#endif
 
 /* Suspend hook structures */
 static const struct dev_pm_ops alarmtimer_pm_ops = {
-- 
1.7.0.4



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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ