treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / mips / include / asm / edac.h
blobc5d14774442398c840c885c18df4e6848a36b044
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef ASM_EDAC_H
3 #define ASM_EDAC_H
5 #include <asm/compiler.h>
7 /* ECC atomic, DMA, SMP and interrupt safe scrub function */
9 static inline void edac_atomic_scrub(void *va, u32 size)
11 unsigned long *virt_addr = va;
12 unsigned long temp;
13 u32 i;
15 for (i = 0; i < size / sizeof(unsigned long); i++) {
17 * Very carefully read and write to memory atomically
18 * so we are interrupt, DMA and SMP safe.
20 * Intel: asm("lock; addl $0, %0"::"m"(*virt_addr));
23 __asm__ __volatile__ (
24 " .set push \n"
25 " .set mips2 \n"
26 "1: ll %0, %1 # edac_atomic_scrub \n"
27 " addu %0, $0 \n"
28 " sc %0, %1 \n"
29 " beqz %0, 1b \n"
30 " .set pop \n"
31 : "=&r" (temp), "=" GCC_OFF_SMALL_ASM() (*virt_addr)
32 : GCC_OFF_SMALL_ASM() (*virt_addr));
34 virt_addr++;
38 #endif