History

locking/atomic: make atomic*_{cmp,}xchg optional

Most architectures define the atomic/atomic64 xchg and cmpxchg operations in terms of arch_xchg and arch_cmpxchg respectfully. Add fallbacks for these cases and remove the trivial cases from arch code. On some architectures the existing definitions are kept as these are used to build other arch_atomic*() operations.

Mark Rutland committed 3 years ago

Commit d12157e1 parent a7bafa723 files · +179 −265Browse files

Showing the changes to scripts (2 of 23 files). Show all

Unified · Split

2 files
  1. scripts/atomic/fallbacks/cmpxchg +7 −0
  2. scripts/atomic/fallbacks/xchg +7 −0
scripts/atomic/fallbacks/cmpxchg+7−0
@@ -0,0 +1,7 @@
1+cat <<EOF
2+static __always_inline ${int}
3+arch_${atomic}_cmpxchg${order}(${atomic}_t *v, ${int} old, ${int} new)
4+{
5+ return arch_cmpxchg${order}(&v->counter, old, new);
6+}
7+EOF
scripts/atomic/fallbacks/xchg+7−0
@@ -0,0 +1,7 @@
1+cat <<EOF
2+static __always_inline ${int}
3+arch_${atomic}_xchg${order}(${atomic}_t *v, ${int} new)
4+{
5+ return arch_xchg${order}(&v->counter, new);
6+}
7+EOF

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t