// SPDX-License-Identifier: GPL-2.0-only //#include #include #include #define ATOMIC64_OP(op, c_op, asm_op) \ void atomic64_##op(long i, atomic64_t * v) \ { \ unsigned long flags; \ \ raw_local_irq_save(flags); \ v->counter c_op i; \ raw_local_irq_restore(flags); \ } #define ATOMIC64_OP_RETURN(op, c_op, asm_op) \ long atomic64_##op##_return(long i, atomic64_t * v) \ { \ unsigned long flags; \ int ret; \ \ raw_local_irq_save(flags); \ ret = (v->counter c_op i); \ raw_local_irq_restore(flags); \ \ return ret; \ } #define ATOMIC64_OPS(op, c_op, asm_op) \ ATOMIC64_OP(op, c_op, asm_op) \ ATOMIC64_OP_RETURN(op, c_op, asm_op) ATOMIC64_OPS(add, +=, daddu) #undef ATOMIC64_OPS #undef ATOMIC64_OP_RETURN #undef ATOMIC64_OP