Here comes my favourite approach to report the frequency of the timer that an I-pipe user takes over: via the very same API. This patch extends ipipe_request_tickdev by a pointer to a variable that shall receive the timer frequency as the hijacked clock_event_device carries it.
This is the most generic, future-proof, and clean approach IMHO, because it doesn't assume anything about the tickdev selection the user may make when requesting the device. Jan
---
include/linux/ipipe_tickdev.h | 2 +-
kernel/ipipe/core.c | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
Index: linux-2.6.23-ipipe/include/linux/ipipe_tickdev.h
===================================================================
--- linux-2.6.23-ipipe.orig/include/linux/ipipe_tickdev.h
+++ linux-2.6.23-ipipe/include/linux/ipipe_tickdev.h
@@ -46,7 +46,7 @@ int ipipe_request_tickdev(const char *de
struct ipipe_tick_device *tdev),
int (*emutick)(unsigned long evt,
struct ipipe_tick_device *tdev),
- int cpu);
+ int cpu, unsigned long *tick_freq);
void ipipe_release_tickdev(int cpu);
Index: linux-2.6.23-ipipe/kernel/ipipe/core.c
===================================================================
--- linux-2.6.23-ipipe.orig/kernel/ipipe/core.c
+++ linux-2.6.23-ipipe/kernel/ipipe/core.c
@@ -123,10 +123,11 @@ int ipipe_request_tickdev(const char *de
struct ipipe_tick_device *tdev),
int (*emutick)(unsigned long delta,
struct ipipe_tick_device *tdev),
- int cpu)
+ int cpu, unsigned long *tick_freq)
{
struct ipipe_tick_device *itd;
struct tick_device *slave;
+ unsigned long long freq;
unsigned long flags;
int status;
@@ -170,6 +171,8 @@ int ipipe_request_tickdev(const char *de
itd->emul_set_tick = emutick;
itd->real_set_mode = slave->evtdev->set_mode;
itd->real_set_tick = slave->evtdev->set_next_event;
+ freq = (1000000000ULL * slave->evtdev->mult) >> slave->evtdev->shift;
+ *tick_freq = (unsigned long)freq;
slave->evtdev->set_mode = __ipipe_set_tick_mode;
slave->evtdev->set_next_event = __ipipe_set_next_tick;
status = slave->evtdev->mode;
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Adeos-main mailing list [email protected] https://mail.gna.org/listinfo/adeos-main
