svn commit: r332891 - head/sys/arm/include
John Baldwin
jhb at FreeBSD.org
Mon Apr 23 16:50:39 UTC 2018
Author: jhb
Date: Mon Apr 23 16:50:37 2018
New Revision: 332891
URL: https://svnweb.freebsd.org/changeset/base/332891
Log:
Fix some harmless type mismatches in the ARM atomic_cmpset implementations.
The return value of atomic_cmpset() and atomic_fcmpset() is an int (which
is really a bool) that has the values 0 or 1. Some of the inlines were
using the type being operated on (e.g. uint32_t) as either the return type
of the function, or the type of a local 'ret' variable used to hold the
return value. Fix all of these to just use plain 'int'. Due to C promotion
rules and the fact that the value can only be 0 or 1, these should all be
harmless.
Reviewed by: imp (only the v4 ones)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D15147
Modified:
head/sys/arm/include/atomic-v4.h
head/sys/arm/include/atomic-v6.h
Modified: head/sys/arm/include/atomic-v4.h
==============================================================================
--- head/sys/arm/include/atomic-v4.h Mon Apr 23 16:38:27 2018 (r332890)
+++ head/sys/arm/include/atomic-v4.h Mon Apr 23 16:50:37 2018 (r332891)
@@ -115,7 +115,7 @@ atomic_clear_64(volatile uint64_t *address, uint64_t c
static __inline int
atomic_fcmpset_32(volatile u_int32_t *p, volatile u_int32_t *cmpval, volatile u_int32_t newval)
{
- u_int32_t ret;
+ int ret;
__with_interrupts_disabled(
{
@@ -134,7 +134,7 @@ atomic_fcmpset_32(volatile u_int32_t *p, volatile u_in
static __inline int
atomic_fcmpset_64(volatile u_int64_t *p, volatile u_int64_t *cmpval, volatile u_int64_t newval)
{
- u_int64_t ret;
+ int ret;
__with_interrupts_disabled(
{
@@ -149,7 +149,7 @@ atomic_fcmpset_64(volatile u_int64_t *p, volatile u_in
return (ret);
}
-static __inline u_int32_t
+static __inline int
atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval)
{
int ret;
@@ -166,7 +166,7 @@ atomic_cmpset_32(volatile u_int32_t *p, volatile u_int
return (ret);
}
-static __inline u_int64_t
+static __inline int
atomic_cmpset_64(volatile u_int64_t *p, volatile u_int64_t cmpval, volatile u_int64_t newval)
{
int ret;
@@ -296,7 +296,7 @@ atomic_clear_32(volatile uint32_t *address, uint32_t c
}
-static __inline u_int32_t
+static __inline int
atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval)
{
int done, ras_start = ARM_RAS_START;
Modified: head/sys/arm/include/atomic-v6.h
==============================================================================
--- head/sys/arm/include/atomic-v6.h Mon Apr 23 16:38:27 2018 (r332890)
+++ head/sys/arm/include/atomic-v6.h Mon Apr 23 16:50:37 2018 (r332891)
@@ -209,7 +209,7 @@ atomic_fcmpset_32(volatile uint32_t *p, uint32_t *cmpv
return (!ret);
}
-static __inline uint64_t
+static __inline int
atomic_fcmpset_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval)
{
uint64_t tmp;
@@ -235,7 +235,7 @@ atomic_fcmpset_64(volatile uint64_t *p, uint64_t *cmpv
return (!ret);
}
-static __inline u_long
+static __inline int
atomic_fcmpset_long(volatile u_long *p, u_long *cmpval, u_long newval)
{
@@ -243,38 +243,38 @@ atomic_fcmpset_long(volatile u_long *p, u_long *cmpval
(uint32_t *)cmpval, newval));
}
-static __inline uint64_t
+static __inline int
atomic_fcmpset_acq_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval)
{
- uint64_t ret;
+ int ret;
ret = atomic_fcmpset_64(p, cmpval, newval);
dmb();
return (ret);
}
-static __inline u_long
+static __inline int
atomic_fcmpset_acq_long(volatile u_long *p, u_long *cmpval, u_long newval)
{
- u_long ret;
+ int ret;
ret = atomic_fcmpset_long(p, cmpval, newval);
dmb();
return (ret);
}
-static __inline uint32_t
+static __inline int
atomic_fcmpset_acq_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval)
{
- uint32_t ret;
+ int ret;
ret = atomic_fcmpset_32(p, cmpval, newval);
dmb();
return (ret);
}
-static __inline uint32_t
+static __inline int
atomic_fcmpset_rel_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval)
{
@@ -282,7 +282,7 @@ atomic_fcmpset_rel_32(volatile uint32_t *p, uint32_t *
return (atomic_fcmpset_32(p, cmpval, newval));
}
-static __inline uint64_t
+static __inline int
atomic_fcmpset_rel_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval)
{
@@ -290,7 +290,7 @@ atomic_fcmpset_rel_64(volatile uint64_t *p, uint64_t *
return (atomic_fcmpset_64(p, cmpval, newval));
}
-static __inline u_long
+static __inline int
atomic_fcmpset_rel_long(volatile u_long *p, u_long *cmpval, u_long newval)
{
@@ -298,10 +298,10 @@ atomic_fcmpset_rel_long(volatile u_long *p, u_long *cm
return (atomic_fcmpset_long(p, cmpval, newval));
}
-static __inline uint32_t
+static __inline int
atomic_cmpset_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval)
{
- uint32_t ret;
+ int ret;
__asm __volatile(
"1: ldrex %0, [%1] \n"
@@ -349,44 +349,44 @@ atomic_cmpset_64(volatile uint64_t *p, uint64_t cmpval
return (ret);
}
-static __inline u_long
+static __inline int
atomic_cmpset_long(volatile u_long *p, u_long cmpval, u_long newval)
{
return (atomic_cmpset_32((volatile uint32_t *)p, cmpval, newval));
}
-static __inline uint32_t
+static __inline int
atomic_cmpset_acq_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval)
{
- uint32_t ret;
+ int ret;
ret = atomic_cmpset_32(p, cmpval, newval);
dmb();
return (ret);
}
-static __inline uint64_t
+static __inline int
atomic_cmpset_acq_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval)
{
- uint64_t ret;
+ int ret;
ret = atomic_cmpset_64(p, cmpval, newval);
dmb();
return (ret);
}
-static __inline u_long
+static __inline int
atomic_cmpset_acq_long(volatile u_long *p, u_long cmpval, u_long newval)
{
- u_long ret;
+ int ret;
ret = atomic_cmpset_long(p, cmpval, newval);
dmb();
return (ret);
}
-static __inline uint32_t
+static __inline int
atomic_cmpset_rel_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval)
{
@@ -394,7 +394,7 @@ atomic_cmpset_rel_32(volatile uint32_t *p, uint32_t cm
return (atomic_cmpset_32(p, cmpval, newval));
}
-static __inline uint64_t
+static __inline int
atomic_cmpset_rel_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval)
{
@@ -402,7 +402,7 @@ atomic_cmpset_rel_64(volatile uint64_t *p, uint64_t cm
return (atomic_cmpset_64(p, cmpval, newval));
}
-static __inline u_long
+static __inline int
atomic_cmpset_rel_long(volatile u_long *p, u_long cmpval, u_long newval)
{
More information about the svn-src-all
mailing list