Saved and total events counters are zeroed after start tracing (Ticket #129)
authorVasiliy Ulyanov <v.ulyanov.samsung.com>
Wed, 21 Dec 2011 13:20:41 +0000 (17:20 +0400)
committerVasiliy Ulyanov <v.ulyanov.samsung.com>
Wed, 21 Dec 2011 13:20:58 +0000 (17:20 +0400)
driver/ec.c
driver/ec.h

index 2441f59..c123bc6 100644 (file)
@@ -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;
index 5ef3358..14c7954 100644 (file)
@@ -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);