We don't have 64-bit atomics on powerpc, but we don't really need them.
authorkettenis <kettenis@openbsd.org>
Fri, 14 Jan 2022 15:00:16 +0000 (15:00 +0000)
committerkettenis <kettenis@openbsd.org>
Fri, 14 Jan 2022 15:00:16 +0000 (15:00 +0000)
So don't provide atomic64_cmpxchg() on powerpc and on other architectures
make its implementation similar to atomic64_xchg().
This makes the tree build again on macppc.

suggested by & ok jsg@

sys/dev/pci/drm/include/linux/atomic.h

index 6440519..4050fdf 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: atomic.h,v 1.17 2022/01/14 06:53:14 jsg Exp $ */
+/* $OpenBSD: atomic.h,v 1.18 2022/01/14 15:00:16 kettenis Exp $ */
 /**
  * \file drm_atomic.h
  * Atomic operations used in the DRM which may or may not be provided by the OS.
@@ -139,6 +139,12 @@ atomic64_xchg(volatile int64_t *v, int64_t n)
        return __sync_lock_test_and_set(v, n);
 }
 
+static inline int64_t
+atomic64_cmpxchg(volatile int64_t *v, int64_t o, int64_t n)
+{
+       return __sync_val_compare_and_swap(v, o, n);
+}
+
 #define atomic64_add(n, p)     __sync_fetch_and_add_8(p, n)
 #define atomic64_sub(n, p)     __sync_fetch_and_sub_8(p, n)
 #define atomic64_inc(p)                __sync_fetch_and_add_8(p, 1)
@@ -222,12 +228,6 @@ atomic64_sub(int i, atomic64_t *v)
 }
 #endif
 
-static inline int64_t
-atomic64_cmpxchg(atomic64_t *p, int64_t o, int64_t n)
-{
-       return atomic_cmpxchg(p, o, n);
-}
-
 #ifdef __LP64__
 typedef int64_t atomic_long_t;
 #define atomic_long_set(p, v)          atomic64_set(p, v)