Skip to content

Commit f3e615b

Browse files
mrutland-armPeter Zijlstra
authored andcommitted
locking/atomic: remove ARCH_ATOMIC remanants
Now that gen-atomic-fallback.sh is only used to generate the arch_* fallbacks, we don't need to also generate the non-arch_* forms, and can removethe infrastructure this needed. There is no change to any of the generated headers as a result of this patch. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20210713105253.7615-3-mark.rutland@arm.com
1 parent 47401d9 commit f3e615b

21 files changed

Lines changed: 71 additions & 91 deletions

‎scripts/atomic/fallbacks/acquire‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
cat <<EOF
22
static __always_inline ${ret}
3-
${arch}${atomic}_${pfx}${name}${sfx}_acquire(${params})
3+
arch_${atomic}_${pfx}${name}${sfx}_acquire(${params})
44
{
5-
${ret} ret = ${arch}${atomic}_${pfx}${name}${sfx}_relaxed(${args});
5+
${ret} ret = arch_${atomic}_${pfx}${name}${sfx}_relaxed(${args});
66
__atomic_acquire_fence();
77
return ret;
88
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cat <<EOF
22
/**
3-
* ${arch}${atomic}_add_negative - add and test if negative
3+
* arch_${atomic}_add_negative - add and test if negative
44
* @i: integer value to add
55
* @v: pointer of type ${atomic}_t
66
*
@@ -9,8 +9,8 @@ cat <<EOF
99
* result is greater than or equal to zero.
1010
*/
1111
static __always_inline bool
12-
${arch}${atomic}_add_negative(${int} i, ${atomic}_t *v)
12+
arch_${atomic}_add_negative(${int} i, ${atomic}_t *v)
1313
{
14-
return ${arch}${atomic}_add_return(i, v) < 0;
14+
return arch_${atomic}_add_return(i, v) < 0;
1515
}
1616
EOF
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cat << EOF
22
/**
3-
* ${arch}${atomic}_add_unless - add unless the number is already a given value
3+
* arch_${atomic}_add_unless - add unless the number is already a given value
44
* @v: pointer of type ${atomic}_t
55
* @a: the amount to add to v...
66
* @u: ...unless v is equal to u.
@@ -9,8 +9,8 @@ cat << EOF
99
* Returns true if the addition was done.
1010
*/
1111
static __always_inline bool
12-
${arch}${atomic}_add_unless(${atomic}_t *v, ${int} a, ${int} u)
12+
arch_${atomic}_add_unless(${atomic}_t *v, ${int} a, ${int} u)
1313
{
14-
return ${arch}${atomic}_fetch_add_unless(v, a, u) != u;
14+
return arch_${atomic}_fetch_add_unless(v, a, u) != u;
1515
}
1616
EOF

‎scripts/atomic/fallbacks/andnot‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cat <<EOF
22
static __always_inline ${ret}
3-
${arch}${atomic}_${pfx}andnot${sfx}${order}(${int} i, ${atomic}_t *v)
3+
arch_${atomic}_${pfx}andnot${sfx}${order}(${int} i, ${atomic}_t *v)
44
{
5-
${retstmt}${arch}${atomic}_${pfx}and${sfx}${order}(~i, v);
5+
${retstmt}arch_${atomic}_${pfx}and${sfx}${order}(~i, v);
66
}
77
EOF

‎scripts/atomic/fallbacks/dec‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cat <<EOF
22
static __always_inline ${ret}
3-
${arch}${atomic}_${pfx}dec${sfx}${order}(${atomic}_t *v)
3+
arch_${atomic}_${pfx}dec${sfx}${order}(${atomic}_t *v)
44
{
5-
${retstmt}${arch}${atomic}_${pfx}sub${sfx}${order}(1, v);
5+
${retstmt}arch_${atomic}_${pfx}sub${sfx}${order}(1, v);
66
}
77
EOF
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
cat <<EOF
22
/**
3-
* ${arch}${atomic}_dec_and_test - decrement and test
3+
* arch_${atomic}_dec_and_test - decrement and test
44
* @v: pointer of type ${atomic}_t
55
*
66
* Atomically decrements @v by 1 and
77
* returns true if the result is 0, or false for all other
88
* cases.
99
*/
1010
static __always_inline bool
11-
${arch}${atomic}_dec_and_test(${atomic}_t *v)
11+
arch_${atomic}_dec_and_test(${atomic}_t *v)
1212
{
13-
return ${arch}${atomic}_dec_return(v) == 0;
13+
return arch_${atomic}_dec_return(v) == 0;
1414
}
1515
EOF

‎scripts/atomic/fallbacks/dec_if_positive‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
cat <<EOF
22
static __always_inline ${ret}
3-
${arch}${atomic}_dec_if_positive(${atomic}_t *v)
3+
arch_${atomic}_dec_if_positive(${atomic}_t *v)
44
{
5-
${int} dec, c = ${arch}${atomic}_read(v);
5+
${int} dec, c = arch_${atomic}_read(v);
66

77
do {
88
dec = c - 1;
99
if (unlikely(dec < 0))
1010
break;
11-
} while (!${arch}${atomic}_try_cmpxchg(v, &c, dec));
11+
} while (!arch_${atomic}_try_cmpxchg(v, &c, dec));
1212

1313
return dec;
1414
}

‎scripts/atomic/fallbacks/dec_unless_positive‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
cat <<EOF
22
static __always_inline bool
3-
${arch}${atomic}_dec_unless_positive(${atomic}_t *v)
3+
arch_${atomic}_dec_unless_positive(${atomic}_t *v)
44
{
5-
${int} c = ${arch}${atomic}_read(v);
5+
${int} c = arch_${atomic}_read(v);
66

77
do {
88
if (unlikely(c > 0))
99
return false;
10-
} while (!${arch}${atomic}_try_cmpxchg(v, &c, c - 1));
10+
} while (!arch_${atomic}_try_cmpxchg(v, &c, c - 1));
1111

1212
return true;
1313
}

‎scripts/atomic/fallbacks/fence‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
cat <<EOF
22
static __always_inline ${ret}
3-
${arch}${atomic}_${pfx}${name}${sfx}(${params})
3+
arch_${atomic}_${pfx}${name}${sfx}(${params})
44
{
55
${ret} ret;
66
__atomic_pre_full_fence();
7-
ret = ${arch}${atomic}_${pfx}${name}${sfx}_relaxed(${args});
7+
ret = arch_${atomic}_${pfx}${name}${sfx}_relaxed(${args});
88
__atomic_post_full_fence();
99
return ret;
1010
}

‎scripts/atomic/fallbacks/fetch_add_unless‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cat << EOF
22
/**
3-
* ${arch}${atomic}_fetch_add_unless - add unless the number is already a given value
3+
* arch_${atomic}_fetch_add_unless - add unless the number is already a given value
44
* @v: pointer of type ${atomic}_t
55
* @a: the amount to add to v...
66
* @u: ...unless v is equal to u.
@@ -9,14 +9,14 @@ cat << EOF
99
* Returns original value of @v
1010
*/
1111
static __always_inline ${int}
12-
${arch}${atomic}_fetch_add_unless(${atomic}_t *v, ${int} a, ${int} u)
12+
arch_${atomic}_fetch_add_unless(${atomic}_t *v, ${int} a, ${int} u)
1313
{
14-
${int} c = ${arch}${atomic}_read(v);
14+
${int} c = arch_${atomic}_read(v);
1515

1616
do {
1717
if (unlikely(c == u))
1818
break;
19-
} while (!${arch}${atomic}_try_cmpxchg(v, &c, c + a));
19+
} while (!arch_${atomic}_try_cmpxchg(v, &c, c + a));
2020

2121
return c;
2222
}

0 commit comments

Comments
 (0)