Skip to contentSkip to conversation

cobalt/kernel: fix compile error for incompatible pointer type

PATCH Applied Fino Meng 2 participants 3 messages Sep 18, 2020 – Sep 21, 2020

lore
Share & tools
lore

Fino Meng

author
#0 lore raw

PATCH 3/4 cobalt/kernel: fix compile error for incompatible pointer type

---
 include/cobalt/kernel/stat.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/cobalt/kernel/stat.h +1 -1
index b857cd19f..be529ad72 100644
@@ -58,7 +58,7 @@ do { \
 #define xnstat_exectime_set_current(sched, new_account) \
 ({ \
 	xnstat_exectime_t *__prev; \
-	__prev = (xnstat_exectime_t *)atomic_long_xchg(&(sched)->current_account, (long)(new_account)); \
+	__prev = (xnstat_exectime_t *)atomic_long_xchg((atomic_long_t *)&(sched)->current_account, (long)(new_account)); \
 	__prev; \
 })
 
Signature · 1 line
2.20.1
#1 lore raw

<no commit message>

Quoted 11 lines · Fino Meng
---
  include/cobalt/kernel/stat.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
include/cobalt/kernel/stat.h +0 -0
index b857cd19f..be529ad72 100644

include/cobalt/kernel/stat.h do { \ · line 61

Quoted 5 lines
include/cobalt/kernel/stat.h +1 -1
@@ -58,7 +58,7 @@ do { \
  #define xnstat_exectime_set_current(sched, new_account) \
  ({ \
  	xnstat_exectime_t *__prev; \
-	__prev = (xnstat_exectime_t *)atomic_long_xchg(&(sched)->current_account, (long)(new_account)); \
+	__prev = (xnstat_exectime_t *)atomic_long_xchg((atomic_long_t *)&(sched)->current_account, (long)(new_account)); \

Which upstream change made this necessary? Was the issue hidden behind too relaxed compiler warnings, or was there a real type change? If the latter, why is that cast OK?

Jan

Quoted 4 lines
include/cobalt/kernel/stat.h +0 -0
  	__prev; \
  })
 
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
author
#2 lore raw
Quoted 24 lines · Jan Kiszka

<no commit message>

Quoted 11 lines · Fino Meng
---
  include/cobalt/kernel/stat.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
include/cobalt/kernel/stat.h +0 -0
index b857cd19f..be529ad72 100644

include/cobalt/kernel/stat.h do { \ · line 61

Quoted 5 lines
include/cobalt/kernel/stat.h +1 -1
@@ -58,7 +58,7 @@ do { \
  #define xnstat_exectime_set_current(sched, new_account) \
  ({ \
  	xnstat_exectime_t *__prev; \
-	__prev = (xnstat_exectime_t *)atomic_long_xchg(&(sched)->current_account, (long)(new_account)); \
+	__prev = (xnstat_exectime_t *)atomic_long_xchg((atomic_long_t *)&(sched)->current_account, (long)(new_account)); \

Which upstream change made this necessary? Was the issue hidden behind too relaxed compiler warnings, or was there a real type change? If the latter, why is that cast OK?

Quoted 1 line

Jan

due to this commit, atomic_long_xchg lost the force type conversion in macro:

commit b5d47ef9ea5c5fe31d7eabeb79f697629bd9e2cb

Refs: v4.19-rc6-94-gb5d47ef9ea5c
Author:     Mark Rutland <[email protected]>
AuthorDate: Tue Sep 4 11:48:27 2018 +0100
Commit:     Ingo Molnar <[email protected]>
CommitDate: Thu Nov 1 11:00:55 2018 +0100

locking/atomics: Switch to generated atomic-long

As a step towards ensuring the atomic* APIs are consistent, let's switch to wrappers generated by gen-atomic-long.h, using the same table that gen-atomic-fallbacks.h uses to fill in gaps in the atomic_* and atomic64_* APIs.
...

include/asm-generic/atomic-long.h

in 4.19 kernel:

#define atomic_long_xchg(v, new) \
        (ATOMIC_LONG_PFX(_xchg)((ATOMIC_LONG_PFX(_t) *)(v), (new)))

#define ATOMIC_LONG_PFX(x) atomic ## x

in 5.4 kernel:

static inline long
atomic_long_xchg(atomic_long_t *v, long i)

{
        return atomic_xchg(v, i);
}

BR fino

Quoted 8 lines
Quoted 4 lines
include/cobalt/kernel/stat.h +0 -0
  	__prev; \
  })
 
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux