[-mm PATCH 5/11] Time: generic timekeeping infrastructure - remove nsec_t

From: john stultz
Date: Tue Feb 21 2006 - 01:21:57 EST


Removes nsec_t as suggested by Roman Zippel
Also removes cycle_t addition from timekeeping-infrastructure patch

Signed-off-by: John Stultz <johnstul@xxxxxxxxxx>


Index: mm-merge/kernel/time/timeofday.c
===================================================================
--- mm-merge.orig/kernel/time/timeofday.c
+++ mm-merge/kernel/time/timeofday.c
@@ -114,7 +114,7 @@ static enum {
TIME_SUSPENDED
} time_suspend_state = TIME_RUNNING;

-static nsec_t suspend_start;
+static s64 suspend_start;

/* [Soft-Timers]
* timeofday_timer:
@@ -155,10 +155,10 @@ static void update_legacy_time_values(vo
* called. Returns the number of nanoseconds since the
* last call to timeofday_periodic_hook() (adjusted by NTP scaling)
*/
-static inline nsec_t __get_nsec_offset(void)
+static inline s64 __get_nsec_offset(void)
{
cycle_t cycle_now, cycle_delta;
- nsec_t ns_offset;
+ s64 ns_offset;

/* read clocksource: */
cycle_now = read_clocksource(clock);
@@ -187,7 +187,7 @@ static inline nsec_t __get_nsec_offset(v
*/
static ktime_t __get_monotonic_clock(void)
{
- nsec_t offset = __get_nsec_offset();
+ s64 offset = __get_nsec_offset();
return ktime_add_ns(system_time, offset);
}

@@ -272,7 +272,7 @@ ktime_t get_realtime_offset(void)
void get_monotonic_clock_ts(struct timespec *ts)
{
unsigned long seq;
- nsec_t offset;
+ s64 offset;

do {
seq = read_seqbegin(&system_time_lock);
@@ -294,7 +294,7 @@ void get_monotonic_clock_ts(struct times
static inline void __get_realtime_clock_ts(struct timespec *ts)
{
unsigned long seq;
- nsec_t nsecs;
+ s64 nsecs;

do {
seq = read_seqbegin(&system_time_lock);
@@ -432,7 +439,7 @@ static int timeofday_suspend_hook(struct
*/
static int timeofday_resume_hook(struct sys_device *dev)
{
- nsec_t suspend_end, suspend_time;
+ s64 suspend_end, suspend_time;
unsigned long flags;

write_seqlock_irqsave(&system_time_lock, flags);
@@ -506,7 +513,7 @@ static void timeofday_periodic_hook(unsi
unsigned long flags;

cycle_t cycle_now, cycle_delta;
- nsec_t delta_nsec;
+ s64 delta_nsec;
static u64 remainder;

long leapsecond = 0;
@@ -517,7 +524,7 @@ static void timeofday_periodic_hook(unsi

int something_changed = 0;
struct clocksource old_clock;
- static nsec_t second_check;
+ static s64 second_check;

write_seqlock_irqsave(&system_time_lock, flags);

Index: mm-merge/include/linux/time.h
===================================================================
--- mm-merge.orig/include/linux/time.h
+++ mm-merge/include/linux/time.h
@@ -27,9 +27,6 @@ struct timezone {

#ifdef __KERNEL__

-/* timeofday base types */
-typedef u64 cycle_t;
-
/* Parameters used to convert the timespec values: */
#define MSEC_PER_SEC 1000L
#define USEC_PER_SEC 1000000L
@@ -152,9 +149,9 @@ extern struct timeval ns_to_timeval(cons
/**
* timespec_add_ns - Adds nanoseconds to a timespec
* @a: pointer to timespec to be incremented
- * @ns: the nanoseconds value to be added
+ * @ns: unsigned nanoseconds value to be added
*/
-static inline void timespec_add_ns(struct timespec *a, nsec_t ns)
+static inline void timespec_add_ns(struct timespec *a, u64 ns)
{
ns += a->tv_nsec;
while(unlikely(ns >= NSEC_PER_SEC)) {
Index: mm-merge/include/asm-generic/timeofday.h
===================================================================
--- mm-merge.orig/include/asm-generic/timeofday.h
+++ mm-merge/include/asm-generic/timeofday.h
@@ -15,7 +15,7 @@

#ifdef CONFIG_GENERIC_TIME
/* Required externs */
-extern nsec_t read_persistent_clock(void);
+extern s64 read_persistent_clock(void);
extern void sync_persistent_clock(struct timespec ts);

#ifdef CONFIG_GENERIC_TIME_VSYSCALL
Index: mm-merge/Documentation/timekeeping.txt
===================================================================
--- mm-merge.orig/Documentation/timekeeping.txt
+++ mm-merge/Documentation/timekeeping.txt
@@ -159,7 +159,7 @@ Porting an arch usually requires the fol

1. Define CONFIG_GENERIC_TIME in the arches Kconfig
2. Implementing the following functions
- nsec_t read_persistent_clock(void)
+ s64 read_persistent_clock(void)
void sync_persistent_clock(struct timespec ts)
3. Removing all of the arch specific timekeeping code
do_gettimeofday()
-
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/