Skip to contentSkip to conversation

freedreno: remove always-defined #ifdef

PATCH In review Eric Engestrom 2 participants 3 messages Nov 7, 2018 – Dec 17, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 freedreno: remove always-defined #ifdef

While at it, let's include xf86atomic.h explicitly, instead of relying on some other file accidentally including it before including this file.

---
 freedreno/freedreno_ringbuffer.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
freedreno/freedreno_ringbuffer.h +1 -2
index bc41a31cd8c5c10a3536..1a1e8425926d0647e358 100644
@@ -29,6 +29,7 @@
 #ifndef FREEDRENO_RINGBUFFER_H_
 #define FREEDRENO_RINGBUFFER_H_
 
+#include <xf86atomic.h>
 #include <freedreno_drmif.h>
 
 /* the ringbuffer object is not opaque so that OUT_RING() type stuff
@@ -83,9 +84,7 @@ struct fd_ringbuffer {
 	 * be inlined for performance reasons.
 	 */
 	union {
-#ifdef HAS_ATOMIC_OPS
 		atomic_t refcnt;
-#endif
 		uint64_t __pad;
 	};
 };
Signature · 7 lines
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 2/2 xf86atomic: #undef internal define

Thanks to the #error just above, any file including this header can only see one state for this macro: defined, with the value 1. Let's just #undef it once we're done using it in here so that other files don't misconstrue any meaning to it.

---
 xf86atomic.h | 2 ++
 1 file changed, 2 insertions(+)
xf86atomic.h +2 -0
index 2d733bd53eea3868259c..e268d274f75b0d7e66f2 100644
@@ -101,6 +101,8 @@ typedef struct { LIBDRM_ATOMIC_TYPE atomic; } atomic_t;
 #error libdrm requires atomic operations, please define them for your CPU/compiler.
 #endif
 
+#undef HAS_ATOMIC_OPS
+
 static inline int atomic_add_unless(atomic_t *v, int add, int unless)
 {
 	int c, old;
Signature · 7 lines
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH libdrm 2/2] xf86atomic: #undef internal define

Quoted 7 lines · Eric Engestrom

Thanks to the #error just above, any file including this header can only see one state for this macro: defined, with the value 1. Let's just #undef it once we're done using it in here so that other files don't misconstrue any meaning to it.

For the series:

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel