Squashed backup commit (no shallow-clone history issues) of xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2 branch, upstream commit 9eece662e) plus all fixes applied to get everpal_defconfig building clean against a modern (GCC 15.2.0) toolchain -- see the previous commit message on the lineage-23.2 branch (also in this repo history is not available here since this is a squashed snapshot; full incremental history lives in the local DL380 checkout and the upstream GitHub remote). Upstream: https://github.com/xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2)
44 lines
919 B
C
44 lines
919 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_MICROBLAZE_CMPXCHG_H
|
|
#define _ASM_MICROBLAZE_CMPXCHG_H
|
|
|
|
#include <linux/irqflags.h>
|
|
|
|
void __bad_xchg(volatile void *ptr, int size);
|
|
|
|
static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
|
|
int size)
|
|
{
|
|
unsigned long ret;
|
|
unsigned long flags;
|
|
|
|
switch (size) {
|
|
case 1:
|
|
local_irq_save(flags);
|
|
ret = *(volatile unsigned char *)ptr;
|
|
*(volatile unsigned char *)ptr = x;
|
|
local_irq_restore(flags);
|
|
break;
|
|
|
|
case 4:
|
|
local_irq_save(flags);
|
|
ret = *(volatile unsigned long *)ptr;
|
|
*(volatile unsigned long *)ptr = x;
|
|
local_irq_restore(flags);
|
|
break;
|
|
default:
|
|
__bad_xchg(ptr, size), ret = 0;
|
|
break;
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
#define xchg(ptr, x) \
|
|
((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
|
|
|
|
#include <asm-generic/cmpxchg.h>
|
|
#include <asm-generic/cmpxchg-local.h>
|
|
|
|
#endif /* _ASM_MICROBLAZE_CMPXCHG_H */
|