From bcff43d29e1b907c159b13130e52d2e020b93470 Mon Sep 17 00:00:00 2001 From: Vasiliy Ulyanov Date: Wed, 21 Dec 2011 17:20:41 +0400 Subject: [PATCH] Saved and total events counters are zeroed after start tracing (Ticket #129) --- driver/ec.c | 14 ++++++++++---- driver/ec.h | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/driver/ec.c b/driver/ec.c index 2441f59..c123bc6 100644 --- a/driver/ec.c +++ b/driver/ec.c @@ -46,10 +46,8 @@ spinlock_t ec_probe_spinlock = SPIN_LOCK_UNLOCKED; // protects 'ec_probe_info' ec_state_t GetECState(void) { return ec_info.ec_state; }; -void ResetECInfo(void) { - unsigned long spinlock_flags = 0L; - - spin_lock_irqsave (&ec_spinlock, spinlock_flags); +void reset_ec_info_nolock(void) +{ ec_info.trace_size = 0; ec_info.first = 0; ec_info.after_last = 0; @@ -62,6 +60,13 @@ void ResetECInfo(void) { ec_info.m_nEndSubbufNum = 0; ec_info.m_nEndOffset = 0; ec_info.m_nSubbufSavedEvents = 0; +} + +void ResetECInfo(void) { + unsigned long spinlock_flags = 0L; + + spin_lock_irqsave (&ec_spinlock, spinlock_flags); + reset_ec_info_nolock(); spin_unlock_irqrestore (&ec_spinlock, spinlock_flags); } @@ -110,6 +115,7 @@ int SetECMode(unsigned long nECMode) { spin_lock_irqsave (&ec_spinlock, spinlock_flags); ec_info.m_nMode = nECMode; + reset_ec_info_nolock(); spin_unlock_irqrestore (&ec_spinlock, spinlock_flags); return 0; diff --git a/driver/ec.h b/driver/ec.h index 5ef3358..14c7954 100644 --- a/driver/ec.h +++ b/driver/ec.h @@ -36,6 +36,7 @@ extern int copy_ec_info_to_user_space (ec_info_t * p_user_ec_info); extern int copy_ec_probe_info_to_user_space (ec_probe_info_t * p_user_ec_probe_info); extern ec_state_t GetECState(void); +extern void reset_ec_info_nolock(void); extern void ResetECInfo(void); extern void CleanECInfo(void); extern int IsECMode(unsigned long nMask); -- 2.7.4