mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] include: asm-generic/atomic.h: always define atomic/atomic_64
@ 2023-09-21  9:43 Ahmad Fatoum
  2023-09-21  9:43 ` [PATCH 2/2] include: add linux/atomic.h header Ahmad Fatoum
  2023-09-21 12:11 ` [PATCH 1/2] include: asm-generic/atomic.h: always define atomic/atomic_64 Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2023-09-21  9:43 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

64-bit accesses are always atomic in barebox, because we have nothing
that would interrupt them. Thus define them unconditionally in the
asm-generic header. This shows that an include for the s64 time is
missing, so add that as well.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/asm-generic/atomic.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 45fc5da57594..27b0f73b487b 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -8,12 +8,13 @@
 #ifndef __ASM_GENERIC_ATOMIC_H
 #define __ASM_GENERIC_ATOMIC_H
 
+#include <linux/types.h>
+
 #ifdef CONFIG_SMP
 #error SMP not supported
 #endif
 #define ATOMIC_INIT(i)	{ (i) }
 
-#ifdef CONFIG_64BIT
 typedef struct { s64 counter; } atomic64_t;
 
 #define atomic64_read(v)	((v)->counter)
@@ -59,7 +60,7 @@ static inline int atomic64_add_negative(s64 i, volatile atomic64_t *v)
 	return val < 0;
 }
 
-#else
+
 typedef struct { volatile int counter; } atomic_t;
 
 #define ATOMIC_INIT(i)	{ (i) }
@@ -114,7 +115,6 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
 {
 	*addr &= ~mask;
 }
-#endif
 
 /* Atomic operations are already serializing on ARM */
 #define smp_mb__before_atomic_dec()	barrier()
-- 
2.39.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] include: add linux/atomic.h header
  2023-09-21  9:43 [PATCH 1/2] include: asm-generic/atomic.h: always define atomic/atomic_64 Ahmad Fatoum
@ 2023-09-21  9:43 ` Ahmad Fatoum
  2023-09-21 12:11 ` [PATCH 1/2] include: asm-generic/atomic.h: always define atomic/atomic_64 Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2023-09-21  9:43 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Linux code usually uses <linux/atomic.h>, so let's have the same in
barebox, which just includes asm-generic/atomic.h.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/linux/atomic.h | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 include/linux/atomic.h

diff --git a/include/linux/atomic.h b/include/linux/atomic.h
new file mode 100644
index 000000000000..9304ab4a34ba
--- /dev/null
+++ b/include/linux/atomic.h
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef LINUX_ATOMIC_H_
+#define LINUX_ATOMIC_H_
+
+#include <asm-generic/atomic.h>
+
+#endif
-- 
2.39.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] include: asm-generic/atomic.h: always define atomic/atomic_64
  2023-09-21  9:43 [PATCH 1/2] include: asm-generic/atomic.h: always define atomic/atomic_64 Ahmad Fatoum
  2023-09-21  9:43 ` [PATCH 2/2] include: add linux/atomic.h header Ahmad Fatoum
@ 2023-09-21 12:11 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-09-21 12:11 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Thu, Sep 21, 2023 at 11:43:53AM +0200, Ahmad Fatoum wrote:
> 64-bit accesses are always atomic in barebox, because we have nothing
> that would interrupt them. Thus define them unconditionally in the
> asm-generic header. This shows that an include for the s64 time is
> missing, so add that as well.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  include/asm-generic/atomic.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
> index 45fc5da57594..27b0f73b487b 100644
> --- a/include/asm-generic/atomic.h
> +++ b/include/asm-generic/atomic.h
> @@ -8,12 +8,13 @@
>  #ifndef __ASM_GENERIC_ATOMIC_H
>  #define __ASM_GENERIC_ATOMIC_H
>  
> +#include <linux/types.h>
> +
>  #ifdef CONFIG_SMP
>  #error SMP not supported
>  #endif
>  #define ATOMIC_INIT(i)	{ (i) }
>  
> -#ifdef CONFIG_64BIT
>  typedef struct { s64 counter; } atomic64_t;
>  
>  #define atomic64_read(v)	((v)->counter)
> @@ -59,7 +60,7 @@ static inline int atomic64_add_negative(s64 i, volatile atomic64_t *v)
>  	return val < 0;
>  }
>  
> -#else
> +
>  typedef struct { volatile int counter; } atomic_t;
>  
>  #define ATOMIC_INIT(i)	{ (i) }
> @@ -114,7 +115,6 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
>  {
>  	*addr &= ~mask;
>  }
> -#endif
>  
>  /* Atomic operations are already serializing on ARM */
>  #define smp_mb__before_atomic_dec()	barrier()
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-21 12:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-21  9:43 [PATCH 1/2] include: asm-generic/atomic.h: always define atomic/atomic_64 Ahmad Fatoum
2023-09-21  9:43 ` [PATCH 2/2] include: add linux/atomic.h header Ahmad Fatoum
2023-09-21 12:11 ` [PATCH 1/2] include: asm-generic/atomic.h: always define atomic/atomic_64 Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox