[PATCH 10/13] hrtimer: rename the "expires" struct member to avoid accidental usage

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Arjan van de Ven
Date: Monday, September 1, 2008 - 4:12 pm

From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [PATCH] hrtimer: rename the "expires" struct member to avoid accidental usage

To catch code that still touches the "expires" memory directly, rename it
to have the compiler complain rather than get nasty, hard to explain,
runtime behavior

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
 include/linux/hrtimer.h |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 9900e99..485a634 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -111,7 +111,7 @@ enum hrtimer_cb_mode {
  */
 struct hrtimer {
 	struct rb_node			node;
-	ktime_t				expires;
+	ktime_t				_expires;
 	enum hrtimer_restart		(*function)(struct hrtimer *);
 	struct hrtimer_clock_base	*base;
 	unsigned long			state;
@@ -219,41 +219,41 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
 
 static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time)
 {
-	timer->expires = time;
+	timer->_expires = time;
 }
 static inline void hrtimer_set_expires_tv64(struct hrtimer *timer, s64 tv64)
 {
-	timer->expires.tv64 = tv64;
+	timer->_expires.tv64 = tv64;
 }
 
 static inline void hrtimer_add_expires(struct hrtimer *timer, ktime_t time)
 {
-	timer->expires = ktime_add_safe(timer->expires, time);
+	timer->_expires = ktime_add_safe(timer->_expires, time);
 }
 
 static inline void hrtimer_add_expires_ns(struct hrtimer *timer, unsigned long ns)
 {
-	timer->expires = ktime_add_ns(timer->expires, ns);
+	timer->_expires = ktime_add_ns(timer->_expires, ns);
 }
 
 static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer)
 {
-	return timer->expires;
+	return timer->_expires;
 }
 
 static inline s64 hrtimer_get_expires_tv64(const struct hrtimer *timer)
 {
-	return timer->expires.tv64;
+	return timer->_expires.tv64;
 }
 
 static inline s64 hrtimer_get_expires_ns(const struct hrtimer *timer)
 {
-	return ktime_to_ns(timer->expires);
+	return ktime_to_ns(timer->_expires);
 }
 
 static inline ktime_t hrtimer_expires_remaining(const struct hrtimer *timer)
 {
-    return ktime_sub(timer->expires, timer->base->get_time());
+    return ktime_sub(timer->_expires, timer->base->get_time());
 }
 
 /*
@@ -334,7 +334,7 @@ static inline int hrtimer_start_expires(struct hrtimer *timer,
 
 static inline int hrtimer_restart(struct hrtimer *timer)
 {
-	return hrtimer_start(timer, timer->expires, HRTIMER_MODE_ABS);
+	return hrtimer_start(timer, timer->_expires, HRTIMER_MODE_ABS);
 }
 
 /* Query timers: */
-- 
1.5.5.1

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/13] Turn hrtimers into a range capable timer, Arjan van de Ven, (Mon Sep 1, 4:03 pm)
[PATCH 2/13] hrtimer: convert kvm to the new hrtimer apis, Arjan van de Ven, (Mon Sep 1, 4:05 pm)
[PATCH 8/13] hrtimer: convert s390 to the new hrtimer apis, Arjan van de Ven, (Mon Sep 1, 4:10 pm)
[PATCH 9/13] hrtimer: convert sound/ to the new hrtimer apis, Arjan van de Ven, (Mon Sep 1, 4:11 pm)
[PATCH 10/13] hrtimer: rename the "expires" struct member ..., Arjan van de Ven, (Mon Sep 1, 4:12 pm)
[PATCH 11/13] hrtimer: turn hrtimers into range timers, Arjan van de Ven, (Mon Sep 1, 4:13 pm)
Re: [PATCH 11/13] hrtimer: turn hrtimers into range timers, Arjan van de Ven, (Tue Sep 2, 6:05 am)
Re: [PATCH 11/13] hrtimer: turn hrtimers into range timers, Arjan van de Ven, (Tue Sep 2, 6:06 am)
Re: [PATCH 11/13] hrtimer: turn hrtimers into range timers, Arjan van de Ven, (Tue Sep 2, 9:02 am)
Re: [PATCH 0/13] Turn hrtimers into a range capable timer, Arjan van de Ven, (Sat Sep 6, 9:30 am)
Re: [PATCH 0/13] Turn hrtimers into a range capable timer, Rusty Russell, (Thu Sep 11, 8:39 pm)
Re: [PATCH 0/13] Turn hrtimers into a range capable timer, Arjan van de Ven, (Thu Sep 11, 10:42 pm)
Re: [PATCH 0/13] Turn hrtimers into a range capable timer, Thomas Gleixner, (Fri Sep 12, 1:24 pm)