[haiku-commits] haiku: hrev52273 - src/add-ons/kernel/bus_managers/ps2

  • From: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 24 Aug 2018 07:59:49 -0400 (EDT)

hrev52273 adds 1 changeset to branch 'master'
old head: 5aff790ae167fc2479eda6348a0ed8da74d11d9a
new head: b2e0398cd4e9df66122a5b03ea6d880b1893db58
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=b2e0398cd4e9+%5E5aff790ae167

----------------------------------------------------------------------------

b2e0398cd4e9: ps2_dev encapsulate TRACING code
  
  Avoid doing system_time() calls in a loop.
  Is this even needed anymore?

                         [ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev52273
Commit:      b2e0398cd4e9df66122a5b03ea6d880b1893db58
URL:         https://git.haiku-os.org/haiku/commit/?id=b2e0398cd4e9
Author:      Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date:        Fri Aug 24 11:51:48 2018 UTC

----------------------------------------------------------------------------

1 file changed, 10 insertions(+), 3 deletions(-)
src/add-ons/kernel/bus_managers/ps2/ps2_dev.cpp | 13 ++++++++++---

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_dev.cpp 
b/src/add-ons/kernel/bus_managers/ps2/ps2_dev.cpp
index faf7829b44..4fa5e55a3a 100644
--- a/src/add-ons/kernel/bus_managers/ps2/ps2_dev.cpp
+++ b/src/add-ons/kernel/bus_managers/ps2/ps2_dev.cpp
@@ -368,7 +368,9 @@ standard_command_timeout(ps2_dev* dev, uint8 cmd, const 
uint8* out,
        int out_count, uint8* in, int in_count, bigtime_t timeout)
 {
        status_t res;
+#ifdef TRACE_PS2
        bigtime_t start;
+#endif
        int32 sem_count;
        int i;
 
@@ -426,16 +428,18 @@ standard_command_timeout(ps2_dev* dev, uint8 cmd, const 
uint8* out,
                }
 
                release_sem(gControllerSem);
-
+#ifdef TRACE_PS2
                start = system_time();
+#endif
                res = acquire_sem_etc(dev->result_sem, 1, B_RELATIVE_TIMEOUT, 
timeout);
 
                if (res != B_OK)
                        atomic_and(&dev->flags, ~PS2_FLAG_CMD);
 
+#ifdef TRACE_PS2
                TRACE("ps2: ps2_dev_command wait for ack res 0x%08" B_PRIx32 ", 
"
                        "wait-time %" B_PRId64 "\n", res, system_time() - 
start);
-
+#endif
                if (atomic_get(&dev->flags) & PS2_FLAG_ACK) {
                        TRACE("ps2: ps2_dev_command got ACK\n");
                }
@@ -454,7 +458,9 @@ standard_command_timeout(ps2_dev* dev, uint8 cmd, const 
uint8* out,
                if (in_count == 0) {
                        atomic_and(&dev->flags, ~PS2_FLAG_CMD);
                } else {
+#ifdef TRACE_PS2
                        start = system_time();
+#endif
                        res = acquire_sem_etc(dev->result_sem, 1, 
B_RELATIVE_TIMEOUT,
                                timeout);
 
@@ -468,11 +474,12 @@ standard_command_timeout(ps2_dev* dev, uint8 cmd, const 
uint8* out,
                                res = B_IO_ERROR;
                        }
 
+#ifdef TRACE_PS2
                        TRACE("ps2: ps2_dev_command wait for input res 0x%08" 
B_PRIx32 ", "
                                "wait-time %" B_PRId64 "\n", res, system_time() 
- start);
-
                        for (i = 0; i < in_count; i++)
                                TRACE("ps2: ps2_dev_command rx: 0x%02x\n", 
in[i]);
+#endif
                }
        }
 


Other related posts:

  • » [haiku-commits] haiku: hrev52273 - src/add-ons/kernel/bus_managers/ps2 - Fredrik Holmqvist