Skip to content

Commit a4c10e1

Browse files
fujitagregkh
authored andcommitted
rust: helpers: Remove volatile qualifier from io helpers
commit 584e614 upstream. Remove the `volatile` qualifier used with __iomem in helper functions in io.c. These helper functions are just wrappers around the corresponding accessors so they are unnecessary. This fixes the following UML build error with CONFIG_RUST enabled: In file included from rust/helpers/helpers.c:19: rust/helpers/io.c:12:10: error: passing 'volatile void *' to parameter of type 'void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] 12 | iounmap(addr); | ^~~~ arch/um/include/asm/io.h:19:42: note: passing argument to parameter 'addr' here 19 | static inline void iounmap(void __iomem *addr) | ^ 1 error generated. [ Arnd explains [1] that removing the qualifier is the way forward (thanks!): Rihgt, I tried this last week when it came up first, removing the 'volatile' annotations in the asm-generic/io.h header and then all the ones that caused build regressions on arm/arm64/x86 randconfig and allmodconfig builds. This patch is a little longer than my original version as I did run into a few regressions later. As far as I can tell, none of these volatile annotations have any actual effect, and most of them date back to ancient kernels where this may have been required. Leaving it out of the rust interface is clearly the right way, and it shouldn't be too hard to upstream the changes below when we need to, but I also don't see any priority to send these. If anyone wants to help out, I can send them the whole patch. I created an issue [2] in case someone wants to help. - Miguel ] Fixes: ce30d94 ("rust: add `io::{Io, IoRaw}` base types") Signed-off-by: FUJITA Tomonori <[email protected]> Cc: [email protected] Reviewed-by: Danilo Krummrich <[email protected]> Link: https://lore.kernel.org/rust-for-linux/[email protected]/ [1] Link: Rust-for-Linux/linux#1156 [2] Link: https://lore.kernel.org/r/[email protected] [ Reworded for relative paths. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9356c09 commit a4c10e1

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

rust/helpers/io.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,94 +7,94 @@ void __iomem *rust_helper_ioremap(phys_addr_t offset, size_t size)
77
return ioremap(offset, size);
88
}
99

10-
void rust_helper_iounmap(volatile void __iomem *addr)
10+
void rust_helper_iounmap(void __iomem *addr)
1111
{
1212
iounmap(addr);
1313
}
1414

15-
u8 rust_helper_readb(const volatile void __iomem *addr)
15+
u8 rust_helper_readb(const void __iomem *addr)
1616
{
1717
return readb(addr);
1818
}
1919

20-
u16 rust_helper_readw(const volatile void __iomem *addr)
20+
u16 rust_helper_readw(const void __iomem *addr)
2121
{
2222
return readw(addr);
2323
}
2424

25-
u32 rust_helper_readl(const volatile void __iomem *addr)
25+
u32 rust_helper_readl(const void __iomem *addr)
2626
{
2727
return readl(addr);
2828
}
2929

3030
#ifdef CONFIG_64BIT
31-
u64 rust_helper_readq(const volatile void __iomem *addr)
31+
u64 rust_helper_readq(const void __iomem *addr)
3232
{
3333
return readq(addr);
3434
}
3535
#endif
3636

37-
void rust_helper_writeb(u8 value, volatile void __iomem *addr)
37+
void rust_helper_writeb(u8 value, void __iomem *addr)
3838
{
3939
writeb(value, addr);
4040
}
4141

42-
void rust_helper_writew(u16 value, volatile void __iomem *addr)
42+
void rust_helper_writew(u16 value, void __iomem *addr)
4343
{
4444
writew(value, addr);
4545
}
4646

47-
void rust_helper_writel(u32 value, volatile void __iomem *addr)
47+
void rust_helper_writel(u32 value, void __iomem *addr)
4848
{
4949
writel(value, addr);
5050
}
5151

5252
#ifdef CONFIG_64BIT
53-
void rust_helper_writeq(u64 value, volatile void __iomem *addr)
53+
void rust_helper_writeq(u64 value, void __iomem *addr)
5454
{
5555
writeq(value, addr);
5656
}
5757
#endif
5858

59-
u8 rust_helper_readb_relaxed(const volatile void __iomem *addr)
59+
u8 rust_helper_readb_relaxed(const void __iomem *addr)
6060
{
6161
return readb_relaxed(addr);
6262
}
6363

64-
u16 rust_helper_readw_relaxed(const volatile void __iomem *addr)
64+
u16 rust_helper_readw_relaxed(const void __iomem *addr)
6565
{
6666
return readw_relaxed(addr);
6767
}
6868

69-
u32 rust_helper_readl_relaxed(const volatile void __iomem *addr)
69+
u32 rust_helper_readl_relaxed(const void __iomem *addr)
7070
{
7171
return readl_relaxed(addr);
7272
}
7373

7474
#ifdef CONFIG_64BIT
75-
u64 rust_helper_readq_relaxed(const volatile void __iomem *addr)
75+
u64 rust_helper_readq_relaxed(const void __iomem *addr)
7676
{
7777
return readq_relaxed(addr);
7878
}
7979
#endif
8080

81-
void rust_helper_writeb_relaxed(u8 value, volatile void __iomem *addr)
81+
void rust_helper_writeb_relaxed(u8 value, void __iomem *addr)
8282
{
8383
writeb_relaxed(value, addr);
8484
}
8585

86-
void rust_helper_writew_relaxed(u16 value, volatile void __iomem *addr)
86+
void rust_helper_writew_relaxed(u16 value, void __iomem *addr)
8787
{
8888
writew_relaxed(value, addr);
8989
}
9090

91-
void rust_helper_writel_relaxed(u32 value, volatile void __iomem *addr)
91+
void rust_helper_writel_relaxed(u32 value, void __iomem *addr)
9292
{
9393
writel_relaxed(value, addr);
9494
}
9595

9696
#ifdef CONFIG_64BIT
97-
void rust_helper_writeq_relaxed(u64 value, volatile void __iomem *addr)
97+
void rust_helper_writeq_relaxed(u64 value, void __iomem *addr)
9898
{
9999
writeq_relaxed(value, addr);
100100
}

0 commit comments

Comments
 (0)