Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: io: add __rust_helper to helpers

This is needed to inline these helpers into Rust code.

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://patch.msgid.link/20251202-define-rust-helper-v1-19-a2e13cbc17a6@google.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

authored by

Alice Ryhl and committed by
Danilo Krummrich
7aab0122 8a03afe9

+34 -30
+34 -30
rust/helpers/io.c
··· 3 3 #include <linux/io.h> 4 4 #include <linux/ioport.h> 5 5 6 - void __iomem *rust_helper_ioremap(phys_addr_t offset, size_t size) 6 + __rust_helper void __iomem *rust_helper_ioremap(phys_addr_t offset, size_t size) 7 7 { 8 8 return ioremap(offset, size); 9 9 } 10 10 11 - void __iomem *rust_helper_ioremap_np(phys_addr_t offset, size_t size) 11 + __rust_helper void __iomem *rust_helper_ioremap_np(phys_addr_t offset, 12 + size_t size) 12 13 { 13 14 return ioremap_np(offset, size); 14 15 } 15 16 16 - void rust_helper_iounmap(void __iomem *addr) 17 + __rust_helper void rust_helper_iounmap(void __iomem *addr) 17 18 { 18 19 iounmap(addr); 19 20 } 20 21 21 - u8 rust_helper_readb(const void __iomem *addr) 22 + __rust_helper u8 rust_helper_readb(const void __iomem *addr) 22 23 { 23 24 return readb(addr); 24 25 } 25 26 26 - u16 rust_helper_readw(const void __iomem *addr) 27 + __rust_helper u16 rust_helper_readw(const void __iomem *addr) 27 28 { 28 29 return readw(addr); 29 30 } 30 31 31 - u32 rust_helper_readl(const void __iomem *addr) 32 + __rust_helper u32 rust_helper_readl(const void __iomem *addr) 32 33 { 33 34 return readl(addr); 34 35 } 35 36 36 37 #ifdef CONFIG_64BIT 37 - u64 rust_helper_readq(const void __iomem *addr) 38 + __rust_helper u64 rust_helper_readq(const void __iomem *addr) 38 39 { 39 40 return readq(addr); 40 41 } 41 42 #endif 42 43 43 - void rust_helper_writeb(u8 value, void __iomem *addr) 44 + __rust_helper void rust_helper_writeb(u8 value, void __iomem *addr) 44 45 { 45 46 writeb(value, addr); 46 47 } 47 48 48 - void rust_helper_writew(u16 value, void __iomem *addr) 49 + __rust_helper void rust_helper_writew(u16 value, void __iomem *addr) 49 50 { 50 51 writew(value, addr); 51 52 } 52 53 53 - void rust_helper_writel(u32 value, void __iomem *addr) 54 + __rust_helper void rust_helper_writel(u32 value, void __iomem *addr) 54 55 { 55 56 writel(value, addr); 56 57 } 57 58 58 59 #ifdef CONFIG_64BIT 59 - void rust_helper_writeq(u64 value, void __iomem *addr) 60 + __rust_helper void rust_helper_writeq(u64 value, void __iomem *addr) 60 61 { 61 62 writeq(value, addr); 62 63 } 63 64 #endif 64 65 65 - u8 rust_helper_readb_relaxed(const void __iomem *addr) 66 + __rust_helper u8 rust_helper_readb_relaxed(const void __iomem *addr) 66 67 { 67 68 return readb_relaxed(addr); 68 69 } 69 70 70 - u16 rust_helper_readw_relaxed(const void __iomem *addr) 71 + __rust_helper u16 rust_helper_readw_relaxed(const void __iomem *addr) 71 72 { 72 73 return readw_relaxed(addr); 73 74 } 74 75 75 - u32 rust_helper_readl_relaxed(const void __iomem *addr) 76 + __rust_helper u32 rust_helper_readl_relaxed(const void __iomem *addr) 76 77 { 77 78 return readl_relaxed(addr); 78 79 } 79 80 80 81 #ifdef CONFIG_64BIT 81 - u64 rust_helper_readq_relaxed(const void __iomem *addr) 82 + __rust_helper u64 rust_helper_readq_relaxed(const void __iomem *addr) 82 83 { 83 84 return readq_relaxed(addr); 84 85 } 85 86 #endif 86 87 87 - void rust_helper_writeb_relaxed(u8 value, void __iomem *addr) 88 + __rust_helper void rust_helper_writeb_relaxed(u8 value, void __iomem *addr) 88 89 { 89 90 writeb_relaxed(value, addr); 90 91 } 91 92 92 - void rust_helper_writew_relaxed(u16 value, void __iomem *addr) 93 + __rust_helper void rust_helper_writew_relaxed(u16 value, void __iomem *addr) 93 94 { 94 95 writew_relaxed(value, addr); 95 96 } 96 97 97 - void rust_helper_writel_relaxed(u32 value, void __iomem *addr) 98 + __rust_helper void rust_helper_writel_relaxed(u32 value, void __iomem *addr) 98 99 { 99 100 writel_relaxed(value, addr); 100 101 } 101 102 102 103 #ifdef CONFIG_64BIT 103 - void rust_helper_writeq_relaxed(u64 value, void __iomem *addr) 104 + __rust_helper void rust_helper_writeq_relaxed(u64 value, void __iomem *addr) 104 105 { 105 106 writeq_relaxed(value, addr); 106 107 } 107 108 #endif 108 109 109 - resource_size_t rust_helper_resource_size(struct resource *res) 110 + __rust_helper resource_size_t rust_helper_resource_size(struct resource *res) 110 111 { 111 112 return resource_size(res); 112 113 } 113 114 114 - struct resource *rust_helper_request_mem_region(resource_size_t start, 115 - resource_size_t n, 116 - const char *name) 115 + __rust_helper struct resource * 116 + rust_helper_request_mem_region(resource_size_t start, resource_size_t n, 117 + const char *name) 117 118 { 118 119 return request_mem_region(start, n, name); 119 120 } 120 121 121 - void rust_helper_release_mem_region(resource_size_t start, resource_size_t n) 122 + __rust_helper void rust_helper_release_mem_region(resource_size_t start, 123 + resource_size_t n) 122 124 { 123 125 release_mem_region(start, n); 124 126 } 125 127 126 - struct resource *rust_helper_request_region(resource_size_t start, 127 - resource_size_t n, const char *name) 128 + __rust_helper struct resource *rust_helper_request_region(resource_size_t start, 129 + resource_size_t n, 130 + const char *name) 128 131 { 129 132 return request_region(start, n, name); 130 133 } 131 134 132 - struct resource *rust_helper_request_muxed_region(resource_size_t start, 133 - resource_size_t n, 134 - const char *name) 135 + __rust_helper struct resource * 136 + rust_helper_request_muxed_region(resource_size_t start, resource_size_t n, 137 + const char *name) 135 138 { 136 139 return request_muxed_region(start, n, name); 137 140 } 138 141 139 - void rust_helper_release_region(resource_size_t start, resource_size_t n) 142 + __rust_helper void rust_helper_release_region(resource_size_t start, 143 + resource_size_t n) 140 144 { 141 145 release_region(start, n); 142 146 }