gallium/radeon: undef the very specific UPDATE_COUNTER macro
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 24 Jan 2017 10:11:59 +0000 (11:11 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 24 Jan 2017 10:17:25 +0000 (11:17 +0100)
Also, wrap this into a do { ... } while (0). Suggested by Nicolai.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeon/r600_gpu_load.c

index 775ac7ac92fd5ec74ab78a095c09812ff1a741b2..83b7bd7210601e111229213d9d98fb7edf83e526 100644 (file)
 #define CB_BUSY(x)             (((x) >> 30) & 0x1)
 #define GUI_ACTIVE(x)          (((x) >> 31) & 0x1)
 
-#define UPDATE_COUNTER(field, mask)                            \
-       if (mask(value))                                        \
-               p_atomic_inc(&counters->named.field.busy);      \
-       else                                                    \
-               p_atomic_inc(&counters->named.field.idle);
+#define UPDATE_COUNTER(field, mask)                                    \
+       do {                                                            \
+               if (mask(value))                                        \
+                       p_atomic_inc(&counters->named.field.busy);      \
+               else                                                    \
+                       p_atomic_inc(&counters->named.field.idle);      \
+       } while (0)
 
 static void r600_update_grbm_counters(struct r600_common_screen *rscreen,
                                      union r600_grbm_counters *counters)
@@ -87,6 +89,8 @@ static void r600_update_grbm_counters(struct r600_common_screen *rscreen,
        UPDATE_COUNTER(gui, GUI_ACTIVE);
 }
 
+#undef UPDATE_COUNTER
+
 static PIPE_THREAD_ROUTINE(r600_gpu_load_thread, param)
 {
        struct r600_common_screen *rscreen = (struct r600_common_screen*)param;