Index: sys/atomic.h =================================================================== RCS file: /cvs/src/sys/sys/atomic.h,v retrieving revision 1.6 diff -u -p -r1.6 atomic.h --- sys/atomic.h 9 Mar 2019 06:14:21 -0000 1.6 +++ sys/atomic.h 15 Jun 2020 11:32:07 -0000 @@ -188,11 +188,107 @@ atomic_sub_long_nv(volatile unsigned lon */ #ifndef atomic_dec_int -#define atomic_dec_int(_p) ((void)atomic_dec_int_nv(_p)) +#define atomic_dec_int(_p, _v) ((void)atomic_dec_int_nv((_p), (_v))) #endif #ifndef atomic_dec_long -#define atomic_dec_long(_p) ((void)atomic_dec_long_nv(_p)) +#define atomic_dec_long(_p, _v) ((void)atomic_dec_long_nv((_p), (_v))) +#endif + +/* + * atomic_set_*_ov + */ + +#ifndef atomic_set_int_ov +static inline unsigned int +atomic_set_int_ov(volatile unsigned int *p, unsigned int v) +{ + unsigned int e, r; + + r = *p; + do { + e = r; + r = atomic_cas_uint(p, e, e | v); + } while (r != e); + + return (r); +} +#endif + +#ifndef atomic_set_long_ov +static inline unsigned long +atomic_set_long_ov(volatile unsigned long *p, unsigned long v) +{ + unsigned long e, r; + + r = *p; + do { + e = r; + r = atomic_cas_ulong(p, e, e | v); + } while (r != e); + + return (r); +} +#endif + +/* + * atomic_set_* + */ + +#ifndef atomic_set_int +#define atomic_set_int(_p, _v) ((void)atomic_set_int_ov((_p), (_v))) +#endif + +#ifndef atomic_set_long +#define atomic_set_long(_p, _v) ((void)atomic_set_long_ov((_p), (_v))) +#endif + +/* + * atomic_clr_*_ov + */ + +#ifndef atomic_clr_int_ov +static inline unsigned int +atomic_clr_int_ov(volatile unsigned int *p, unsigned int v) +{ + unsigned int e, r; + + r = *p; + do { + e = r; + r = atomic_cas_uint(p, e, e & ~v); + } while (r != e); + + return (r); +} +#endif + +#ifndef atomic_clr_long_ov +static inline unsigned long +atomic_clr_long_ov(volatile unsigned long *p, unsigned long v) +{ + unsigned long e, r; + + r = *p; + do { + e = r; + r = atomic_cas_ulong(p, e, e & ~v); + } while (r != e); + + return (r); +} +#endif + +/* + * atomic_clr_* + */ + +#ifndef atomic_clr_int +#define atomic_clr_int(_p) ((void)atomic_clr_int_ov(_p)) +#endif + +#ifndef atomic_clr_long +#define atomic_clr_long(_p) ((void)atomic_clr_long_ov(_p)) #endif /* Index: dev/pci/drm/include/linux/atomic.h =================================================================== RCS file: /cvs/src/sys/dev/pci/drm/include/linux/atomic.h,v retrieving revision 1.5 diff -u -p -r1.5 atomic.h --- dev/pci/drm/include/linux/atomic.h 17 Aug 2019 06:07:22 -0000 1.5 +++ dev/pci/drm/include/linux/atomic.h 15 Jun 2020 11:32:07 -0000 @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #define atomic_set(p, v) (*(p) = (v)) @@ -211,7 +211,6 @@ atomic_inc_not_zero(atomic_t *p) } /* FIXME */ -#define atomic_set_int(p, bits) atomic_setbits_int(p,bits) #define atomic_set_mask(bits, p) atomic_setbits_int(p,bits) #define atomic_clear_int(p, bits) atomic_clearbits_int(p,bits) #define atomic_clear_mask(bits, p) atomic_clearbits_int(p,bits)