History

Merge tag 'asm-generic-fixes-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic

Pull asm-generic fixes from Arnd Bergmann: "These are minor fixes to address false-positive build warnings: Some of the less common I/O accessors are missing __force casts and cause sparse warnings for their implied byteswap, and a recent change to __generic_cmpxchg_local() causes a warning about constant integer truncation" * tag 'asm-generic-fixes-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: asm-generic: avoid __generic_cmpxchg_local warnings asm-generic/io.h: suppress endianness warnings for relaxed accessors asm-generic/io.h: suppress endianness warnings for readq() and writeq()

Linus Torvalds committed 3 years ago

Commit fcff5f92 parents 99ddf22 656e9004 files · +19 −19Browse files

Showing the changes to include (4 of 4 files). Show all

Unified · Split

4 files
  1. include/asm-generic/atomic.h +2 −2
  2. include/asm-generic/cmpxchg-local.h +6 −6
  3. include/asm-generic/cmpxchg.h +3 −3
  4. include/asm-generic/io.h +8 −8
include/asm-generic/atomic.h+2−2
@@ -130,7 +130,7 @@ ATOMIC_OP(xor, ^) · 129 unmodified lines
130#define arch_atomic_read(v) READ_ONCE((v)->counter)130#define arch_atomic_read(v) READ_ONCE((v)->counter)
131#define arch_atomic_set(v, i) WRITE_ONCE(((v)->counter), (i))131#define arch_atomic_set(v, i) WRITE_ONCE(((v)->counter), (i))
132 132
133#define arch_atomic_xchg(ptr, v) (arch_xchg(&(ptr)->counter, (v)))133#define arch_atomic_xchg(ptr, v) (arch_xchg(&(ptr)->counter, (u32)(v)))
134#define arch_atomic_cmpxchg(v, old, new) (arch_cmpxchg(&((v)->counter), (old), (new)))134#define arch_atomic_cmpxchg(v, old, new) (arch_cmpxchg(&((v)->counter), (u32)(old), (u32)(new)))
135 135
136#endif /* __ASM_GENERIC_ATOMIC_H */136#endif /* __ASM_GENERIC_ATOMIC_H */
include/asm-generic/cmpxchg-local.h+6−6
@@ -26,16 +26,16 @@ static inline unsigned long __generic_cmpxchg_local(volatile void *ptr, · 25 unmodified lines
26 raw_local_irq_save(flags);26 raw_local_irq_save(flags);
27 switch (size) {27 switch (size) {
28 case 1: prev = *(u8 *)ptr;28 case 1: prev = *(u8 *)ptr;
29 if (prev == (u8)old)29 if (prev == (old & 0xffu))
30 *(u8 *)ptr = (u8)new;30 *(u8 *)ptr = (new & 0xffu);
31 break;31 break;
32 case 2: prev = *(u16 *)ptr;32 case 2: prev = *(u16 *)ptr;
33 if (prev == (u16)old)33 if (prev == (old & 0xffffu))
34 *(u16 *)ptr = (u16)new;34 *(u16 *)ptr = (new & 0xffffu);
35 break;35 break;
36 case 4: prev = *(u32 *)ptr;36 case 4: prev = *(u32 *)ptr;
37 if (prev == (u32)old)37 if (prev == (old & 0xffffffffffu))
38 *(u32 *)ptr = (u32)new;38 *(u32 *)ptr = (new & 0xffffffffu);
39 break;39 break;
40 case 8: prev = *(u64 *)ptr;40 case 8: prev = *(u64 *)ptr;
41 if (prev == old)41 if (prev == old)
include/asm-generic/cmpxchg.h+3−3
@@ -32,7 +32,7 @@ unsigned long __generic_xchg(unsigned long x, volatile void *ptr, int size) · 31 unmodified lines
32#else32#else
33 local_irq_save(flags);33 local_irq_save(flags);
34 ret = *(volatile u8 *)ptr;34 ret = *(volatile u8 *)ptr;
35 *(volatile u8 *)ptr = x;35 *(volatile u8 *)ptr = (x & 0xffu);
36 local_irq_restore(flags);36 local_irq_restore(flags);
37 return ret;37 return ret;
38#endif /* __xchg_u8 */38#endif /* __xchg_u8 */
@@ -43,7 +43,7 @@ unsigned long __generic_xchg(unsigned long x, volatile void *ptr, int size) · 4 unmodified lines
43#else43#else
44 local_irq_save(flags);44 local_irq_save(flags);
45 ret = *(volatile u16 *)ptr;45 ret = *(volatile u16 *)ptr;
46 *(volatile u16 *)ptr = x;46 *(volatile u16 *)ptr = (x & 0xffffu);
47 local_irq_restore(flags);47 local_irq_restore(flags);
48 return ret;48 return ret;
49#endif /* __xchg_u16 */49#endif /* __xchg_u16 */
@@ -54,7 +54,7 @@ unsigned long __generic_xchg(unsigned long x, volatile void *ptr, int size) · 4 unmodified lines
54#else54#else
55 local_irq_save(flags);55 local_irq_save(flags);
56 ret = *(volatile u32 *)ptr;56 ret = *(volatile u32 *)ptr;
57 *(volatile u32 *)ptr = x;57 *(volatile u32 *)ptr = (x & 0xffffffffu);
58 local_irq_restore(flags);58 local_irq_restore(flags);
59 return ret;59 return ret;
60#endif /* __xchg_u32 */60#endif /* __xchg_u32 */
include/asm-generic/io.h+8−8
@@ -236,7 +236,7 @@ static inline u64 readq(const volatile void __iomem *addr) · 235 unmodified lines
236 236
237 log_read_mmio(64, addr, _THIS_IP_, _RET_IP_);237 log_read_mmio(64, addr, _THIS_IP_, _RET_IP_);
238 __io_br();238 __io_br();
239 val = __le64_to_cpu(__raw_readq(addr));239 val = __le64_to_cpu((__le64 __force)__raw_readq(addr));
240 __io_ar(val);240 __io_ar(val);
241 log_post_read_mmio(val, 64, addr, _THIS_IP_, _RET_IP_);241 log_post_read_mmio(val, 64, addr, _THIS_IP_, _RET_IP_);
242 return val;242 return val;
@@ -287,7 +287,7 @@ static inline void writeq(u64 value, volatile void __iomem *addr) · 44 unmodified lines
287{287{
288 log_write_mmio(value, 64, addr, _THIS_IP_, _RET_IP_);288 log_write_mmio(value, 64, addr, _THIS_IP_, _RET_IP_);
289 __io_bw();289 __io_bw();
290 __raw_writeq(__cpu_to_le64(value), addr);290 __raw_writeq((u64 __force)__cpu_to_le64(value), addr);
291 __io_aw();291 __io_aw();
292 log_post_write_mmio(value, 64, addr, _THIS_IP_, _RET_IP_);292 log_post_write_mmio(value, 64, addr, _THIS_IP_, _RET_IP_);
293}293}
@@ -319,7 +319,7 @@ static inline u16 readw_relaxed(const volatile void __iomem *addr) · 25 unmodified lines
319 u16 val;319 u16 val;
320 320
321 log_read_mmio(16, addr, _THIS_IP_, _RET_IP_);321 log_read_mmio(16, addr, _THIS_IP_, _RET_IP_);
322 val = __le16_to_cpu(__raw_readw(addr));322 val = __le16_to_cpu((__le16 __force)__raw_readw(addr));
323 log_post_read_mmio(val, 16, addr, _THIS_IP_, _RET_IP_);323 log_post_read_mmio(val, 16, addr, _THIS_IP_, _RET_IP_);
324 return val;324 return val;
325}325}
@@ -332,7 +332,7 @@ static inline u32 readl_relaxed(const volatile void __iomem *addr) · 6 unmodified lines
332 u32 val;332 u32 val;
333 333
334 log_read_mmio(32, addr, _THIS_IP_, _RET_IP_);334 log_read_mmio(32, addr, _THIS_IP_, _RET_IP_);
335 val = __le32_to_cpu(__raw_readl(addr));335 val = __le32_to_cpu((__le32 __force)__raw_readl(addr));
336 log_post_read_mmio(val, 32, addr, _THIS_IP_, _RET_IP_);336 log_post_read_mmio(val, 32, addr, _THIS_IP_, _RET_IP_);
337 return val;337 return val;
338}338}
@@ -345,7 +345,7 @@ static inline u64 readq_relaxed(const volatile void __iomem *addr) · 6 unmodified lines
345 u64 val;345 u64 val;
346 346
347 log_read_mmio(64, addr, _THIS_IP_, _RET_IP_);347 log_read_mmio(64, addr, _THIS_IP_, _RET_IP_);
348 val = __le64_to_cpu(__raw_readq(addr));348 val = __le64_to_cpu((__le64 __force)__raw_readq(addr));
349 log_post_read_mmio(val, 64, addr, _THIS_IP_, _RET_IP_);349 log_post_read_mmio(val, 64, addr, _THIS_IP_, _RET_IP_);
350 return val;350 return val;
351}351}
@@ -366,7 +366,7 @@ static inline void writeb_relaxed(u8 value, volatile void __iomem *addr) · 14 unmodified lines
366static inline void writew_relaxed(u16 value, volatile void __iomem *addr)366static inline void writew_relaxed(u16 value, volatile void __iomem *addr)
367{367{
368 log_write_mmio(value, 16, addr, _THIS_IP_, _RET_IP_);368 log_write_mmio(value, 16, addr, _THIS_IP_, _RET_IP_);
369 __raw_writew(cpu_to_le16(value), addr);369 __raw_writew((u16 __force)cpu_to_le16(value), addr);
370 log_post_write_mmio(value, 16, addr, _THIS_IP_, _RET_IP_);370 log_post_write_mmio(value, 16, addr, _THIS_IP_, _RET_IP_);
371}371}
372#endif372#endif
@@ -376,7 +376,7 @@ static inline void writew_relaxed(u16 value, volatile void __iomem *addr) · 3 unmodified lines
376static inline void writel_relaxed(u32 value, volatile void __iomem *addr)376static inline void writel_relaxed(u32 value, volatile void __iomem *addr)
377{377{
378 log_write_mmio(value, 32, addr, _THIS_IP_, _RET_IP_);378 log_write_mmio(value, 32, addr, _THIS_IP_, _RET_IP_);
379 __raw_writel(__cpu_to_le32(value), addr);379 __raw_writel((u32 __force)__cpu_to_le32(value), addr);
380 log_post_write_mmio(value, 32, addr, _THIS_IP_, _RET_IP_);380 log_post_write_mmio(value, 32, addr, _THIS_IP_, _RET_IP_);
381}381}
382#endif382#endif
@@ -386,7 +386,7 @@ static inline void writel_relaxed(u32 value, volatile void __iomem *addr) · 3 unmodified lines
386static inline void writeq_relaxed(u64 value, volatile void __iomem *addr)386static inline void writeq_relaxed(u64 value, volatile void __iomem *addr)
387{387{
388 log_write_mmio(value, 64, addr, _THIS_IP_, _RET_IP_);388 log_write_mmio(value, 64, addr, _THIS_IP_, _RET_IP_);
389 __raw_writeq(__cpu_to_le64(value), addr);389 __raw_writeq((u64 __force)__cpu_to_le64(value), addr);
390 log_post_write_mmio(value, 64, addr, _THIS_IP_, _RET_IP_);390 log_post_write_mmio(value, 64, addr, _THIS_IP_, _RET_IP_);
391}391}
392#endif392#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t