VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   34 Branches   58 Tags
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100  1) cat << EOF
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100  2) /**
f3e615b4db1fb (Mark Rutland 2021-07-13 11:52:50 +0100  3)  * arch_${atomic}_fetch_add_unless - add unless the number is already a given value
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100  4)  * @v: pointer of type ${atomic}_t
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100  5)  * @a: the amount to add to v...
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100  6)  * @u: ...unless v is equal to u.
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100  7)  *
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100  8)  * Atomically adds @a to @v, so long as @v was not already @u.
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100  9)  * Returns original value of @v
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 10)  */
765dcd209947e (Marco Elver  2019-11-26 15:04:05 +0100 11) static __always_inline ${int}
f3e615b4db1fb (Mark Rutland 2021-07-13 11:52:50 +0100 12) arch_${atomic}_fetch_add_unless(${atomic}_t *v, ${int} a, ${int} u)
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 13) {
f3e615b4db1fb (Mark Rutland 2021-07-13 11:52:50 +0100 14) 	${int} c = arch_${atomic}_read(v);
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 15) 
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 16) 	do {
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 17) 		if (unlikely(c == u))
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 18) 			break;
f3e615b4db1fb (Mark Rutland 2021-07-13 11:52:50 +0100 19) 	} while (!arch_${atomic}_try_cmpxchg(v, &c, c + a));
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 20) 
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 21) 	return c;
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 22) }
ace9bad4df268 (Mark Rutland 2018-09-04 11:48:25 +0100 23) EOF