Skip to contentSkip to conversation

Refactor clock_event_device emulation

PATCH New Jan Kiszka 1 participant 1 message Nov 12, 2007 High-resolution timers, timer wheel, clockevents

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 2/2 Refactor clock_event_device emulation

I-pipe's current hooking into the GENERIC_CLOCKEVENTS infrastructure contains an ugly out-of-band argument passing via the device structure (delta...) and unneeded indirections of the intercepted services. This patches overcomes both by cleanly modifying relevant properties of the clock_event_device on takeover.

Jan

---
 include/linux/clockchips.h    |    1 
 include/linux/ipipe_tickdev.h |   11 +++++---
 kernel/ipipe/core.c           |   54 +++++++++++++++++-------------------------
 kernel/time/clockevents.c     |    1 
 4 files changed, 30 insertions(+), 37 deletions(-)
include/linux/clockchips.h +0 -1
Index: linux-2.6.23.1-xeno/include/linux/clockchips.h
===================================================================
@@ -91,7 +91,6 @@ struct clock_event_device {
 	struct list_head	list;
 	enum clock_event_mode	mode;
 	ktime_t			next_event;
-	int64_t			delta;
 };
 
 /*
include/linux/ipipe_tickdev.h +7 -4
Index: linux-2.6.23.1-xeno/include/linux/ipipe_tickdev.h
===================================================================
@@ -31,21 +31,24 @@ struct tick_device;
 struct ipipe_tick_device {
 
 	void (*emul_set_mode)(enum clock_event_mode,
-			      struct ipipe_tick_device *tdev);
+			      struct clock_event_device *cdev);
 	int (*emul_set_tick)(unsigned long delta,
-			     struct ipipe_tick_device *tdev);
+			     struct clock_event_device *cdev);
 	void (*real_set_mode)(enum clock_event_mode mode,
 			      struct clock_event_device *cdev);
 	int (*real_set_tick)(unsigned long delta,
 			     struct clock_event_device *cdev);
 	struct tick_device *slave;
+	unsigned long real_max_delta_ns;
+	unsigned long real_mult;
+	int real_shift;
 };
 
 int ipipe_request_tickdev(const char *devname,
 			  void (*emumode)(enum clock_event_mode mode,
-					  struct ipipe_tick_device *tdev),
+					  struct clock_event_device *cdev),
 			  int (*emutick)(unsigned long evt,
-					 struct ipipe_tick_device *tdev),
+					 struct clock_event_device *cdev),
 			  int cpu, unsigned long *tick_freq);
 
 void ipipe_release_tickdev(int cpu);
kernel/ipipe/core.c +23 -31

89 lines not on this page · raw message

kernel/time/clockevents.c +0 -1
Index: linux-2.6.23.1-xeno/kernel/time/clockevents.c
===================================================================
@@ -84,7 +84,6 @@ int clockevents_program_event(struct clo
 		return -ETIME;
 
 	dev->next_event = expires;
-	dev->delta = delta;
 
 	if (dev->mode == CLOCK_EVT_MODE_SHUTDOWN)
 		return 0;