2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/rust/helpers
FUJITA Tomonori c1b4071ec3 rust: helpers: Add dma_alloc_attrs() and dma_free_attrs()
Add dma_alloc_attrs() and dma_free_attrs() helpers to fix a build
error when CONFIG_HAS_DMA is not enabled.

Note that when CONFIG_HAS_DMA is enabled, dma_alloc_attrs() and
dma_free_attrs() are included in both bindings_generated.rs and
bindings_helpers_generated.rs. The former takes precedence so behavior
remains unchanged in that case.

This fixes the following build error on UML:

error[E0425]: cannot find function `dma_alloc_attrs` in crate `bindings`
     --> rust/kernel/dma.rs:171:23
      |
171   |               bindings::dma_alloc_attrs(
      |                         ^^^^^^^^^^^^^^^ help: a function with a similar name exists: `dma_alloc_pages`
      |
     ::: rust/bindings/bindings_generated.rs:44568:5
      |
44568 | /     pub fn dma_alloc_pages(
44569 | |         dev: *mut device,
44570 | |         size: usize,
44571 | |         dma_handle: *mut dma_addr_t,
44572 | |         dir: dma_data_direction,
44573 | |         gfp: gfp_t,
44574 | |     ) -> *mut page;
      | |___________________- similarly named function `dma_alloc_pages` defined here

error[E0425]: cannot find function `dma_free_attrs` in crate `bindings`
     --> rust/kernel/dma.rs:293:23
      |
293   |               bindings::dma_free_attrs(
      |                         ^^^^^^^^^^^^^^ help: a function with a similar name exists: `dma_free_pages`
      |
     ::: rust/bindings/bindings_generated.rs:44577:5
      |
44577 | /     pub fn dma_free_pages(
44578 | |         dev: *mut device,
44579 | |         size: usize,
44580 | |         page: *mut page,
44581 | |         dma_handle: dma_addr_t,
44582 | |         dir: dma_data_direction,
44583 | |     );
      | |______- similarly named function `dma_free_pages` defined here

Fixes: ad2907b4e3 ("rust: add dma coherent allocator abstraction")
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Link: https://lore.kernel.org/r/20250412000507.157000-1-fujita.tomonori@gmail.com
[ Reworded for relative paths. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2025-04-15 23:06:03 +02:00
..
blk.c
bug.c
build_assert.c
build_bug.c rust: helpers: remove unnecessary header includes 2024-10-21 17:35:59 +02:00
cpumask.c rust: Add cpumask helpers 2025-02-28 13:34:40 -05:00
cred.c rust: cred: add Rust abstraction for struct cred 2024-09-30 13:02:28 +02:00
device.c rust: add devres abstraction 2024-12-20 17:19:26 +01:00
dma.c rust: helpers: Add dma_alloc_attrs() and dma_free_attrs() 2025-04-15 23:06:03 +02:00
err.c rust: helpers: remove unnecessary header includes 2024-10-21 17:35:59 +02:00
fs.c rust: file: add Rust abstraction for struct file 2024-09-30 13:02:28 +02:00
helpers.c rust: helpers: Add dma_alloc_attrs() and dma_free_attrs() 2025-04-15 23:06:03 +02:00
io.c rust: helpers: Remove volatile qualifier from io helpers 2025-04-15 23:03:00 +02:00
jump_label.c rust: add static_branch_unlikely for static_key_false 2024-11-04 16:21:44 -05:00
kunit.c rust: helpers: remove unnecessary header includes 2024-10-21 17:35:59 +02:00
mutex.c rust: sync: Add lock::Backend::assert_is_held() 2024-12-19 14:04:42 -08:00
page.c
pci.c rust: pci: add basic PCI device / driver abstractions 2024-12-20 17:19:26 +01:00
pid_namespace.c rust: add PidNamespace 2024-10-08 15:44:36 +02:00
platform.c rust: platform: add basic platform device / driver abstractions 2024-12-20 17:21:05 +01:00
rbtree.c rust: rbtree: add red-black tree implementation backed by the C version 2024-08-31 17:35:08 +02:00
rcu.c rust: add rcu abstraction 2024-12-20 17:19:26 +01:00
refcount.c rust: helpers: remove unnecessary header includes 2024-10-21 17:35:59 +02:00
security.c rust: replace lsm context+len with lsm_context 2024-12-04 15:02:29 -05:00
signal.c rust: helpers: remove unnecessary header includes 2024-10-21 17:35:59 +02:00
slab.c rust: alloc: implement KVmalloc allocator 2024-10-15 22:56:59 +02:00
spinlock.c rust: sync: Add lock::Backend::assert_is_held() 2024-12-19 14:04:42 -08:00
sync.c rust: lockdep: Use Pin for all LockClassKey usages 2025-03-08 00:55:04 +01:00
task.c Rust changes for v6.13 2024-11-26 14:00:26 -08:00
uaccess.c
vmalloc.c rust: alloc: implement Vmalloc allocator 2024-10-15 22:56:59 +02:00
wait.c rust: helpers: remove unnecessary header includes 2024-10-21 17:35:59 +02:00
workqueue.c rust: helpers: remove unnecessary header includes 2024-10-21 17:35:59 +02:00