Skip to content

Commit

Permalink
MIPS: atomic_*(): Change type of intermediate variables.
Browse files Browse the repository at this point in the history
This shaves of 1912 bytes of an IP27 defconfig kernel and avoids
unexpected overflow behaviour in atomic_sub_if_positive.  Apply the same
changes to the atomic64_* functions for consistency.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Ralf Baechle committed Jan 30, 2009
1 parent c7c1e38 commit 915ec1e
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions arch/mips/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
static __inline__ void atomic_add(int i, atomic_t * v)
{
if (cpu_has_llsc && R10000_LLSC_WAR) {
unsigned long temp;
int temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand All @@ -62,7 +62,7 @@ static __inline__ void atomic_add(int i, atomic_t * v)
: "=&r" (temp), "=m" (v->counter)
: "Ir" (i), "m" (v->counter));
} else if (cpu_has_llsc) {
unsigned long temp;
int temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand Down Expand Up @@ -95,7 +95,7 @@ static __inline__ void atomic_add(int i, atomic_t * v)
static __inline__ void atomic_sub(int i, atomic_t * v)
{
if (cpu_has_llsc && R10000_LLSC_WAR) {
unsigned long temp;
int temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand All @@ -107,7 +107,7 @@ static __inline__ void atomic_sub(int i, atomic_t * v)
: "=&r" (temp), "=m" (v->counter)
: "Ir" (i), "m" (v->counter));
} else if (cpu_has_llsc) {
unsigned long temp;
int temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand Down Expand Up @@ -135,12 +135,12 @@ static __inline__ void atomic_sub(int i, atomic_t * v)
*/
static __inline__ int atomic_add_return(int i, atomic_t * v)
{
unsigned long result;
int result;

smp_llsc_mb();

if (cpu_has_llsc && R10000_LLSC_WAR) {
unsigned long temp;
int temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand All @@ -154,7 +154,7 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
: "Ir" (i), "m" (v->counter)
: "memory");
} else if (cpu_has_llsc) {
unsigned long temp;
int temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand Down Expand Up @@ -187,12 +187,12 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)

static __inline__ int atomic_sub_return(int i, atomic_t * v)
{
unsigned long result;
int result;

smp_llsc_mb();

if (cpu_has_llsc && R10000_LLSC_WAR) {
unsigned long temp;
int temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand All @@ -206,7 +206,7 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
: "Ir" (i), "m" (v->counter)
: "memory");
} else if (cpu_has_llsc) {
unsigned long temp;
int temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand Down Expand Up @@ -247,12 +247,12 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
*/
static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
{
unsigned long result;
int result;

smp_llsc_mb();

if (cpu_has_llsc && R10000_LLSC_WAR) {
unsigned long temp;
int temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand All @@ -270,7 +270,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
: "Ir" (i), "m" (v->counter)
: "memory");
} else if (cpu_has_llsc) {
unsigned long temp;
int temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand Down Expand Up @@ -429,7 +429,7 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
static __inline__ void atomic64_add(long i, atomic64_t * v)
{
if (cpu_has_llsc && R10000_LLSC_WAR) {
unsigned long temp;
long temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand All @@ -441,7 +441,7 @@ static __inline__ void atomic64_add(long i, atomic64_t * v)
: "=&r" (temp), "=m" (v->counter)
: "Ir" (i), "m" (v->counter));
} else if (cpu_has_llsc) {
unsigned long temp;
long temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand Down Expand Up @@ -474,7 +474,7 @@ static __inline__ void atomic64_add(long i, atomic64_t * v)
static __inline__ void atomic64_sub(long i, atomic64_t * v)
{
if (cpu_has_llsc && R10000_LLSC_WAR) {
unsigned long temp;
long temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand All @@ -486,7 +486,7 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v)
: "=&r" (temp), "=m" (v->counter)
: "Ir" (i), "m" (v->counter));
} else if (cpu_has_llsc) {
unsigned long temp;
long temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand Down Expand Up @@ -514,12 +514,12 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v)
*/
static __inline__ long atomic64_add_return(long i, atomic64_t * v)
{
unsigned long result;
long result;

smp_llsc_mb();

if (cpu_has_llsc && R10000_LLSC_WAR) {
unsigned long temp;
long temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand All @@ -533,7 +533,7 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
: "Ir" (i), "m" (v->counter)
: "memory");
} else if (cpu_has_llsc) {
unsigned long temp;
long temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand Down Expand Up @@ -566,12 +566,12 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)

static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
{
unsigned long result;
long result;

smp_llsc_mb();

if (cpu_has_llsc && R10000_LLSC_WAR) {
unsigned long temp;
long temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand All @@ -585,7 +585,7 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
: "Ir" (i), "m" (v->counter)
: "memory");
} else if (cpu_has_llsc) {
unsigned long temp;
long temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand Down Expand Up @@ -626,12 +626,12 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
*/
static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
{
unsigned long result;
long result;

smp_llsc_mb();

if (cpu_has_llsc && R10000_LLSC_WAR) {
unsigned long temp;
long temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand All @@ -649,7 +649,7 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
: "Ir" (i), "m" (v->counter)
: "memory");
} else if (cpu_has_llsc) {
unsigned long temp;
long temp;

__asm__ __volatile__(
" .set mips3 \n"
Expand Down

0 comments on commit 915ec1e

Please sign in to comment.