diff options
author | Takashi Iwai <tiwai@suse.de> | 2025-08-29 11:13:09 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2025-08-29 11:13:09 +0200 |
commit | 3e93d5bbcbfc3808f83712c0701f9d4c148cc8ed (patch) | |
tree | 2f1ac64d01ba1938b12d6036fa7161340a9abded /rust/kernel/alloc/allocator_test.rs | |
parent | 2cbe4ac193ed7172cfd825c0cc46ce4a41be4ba1 (diff) | |
parent | 3e7fd1febc3156d3d98fba229399a13b12d69707 (diff) |
Merge tag 'asoc-fix-v6.17-rc3' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v6.17
The main fixes here are for some of the cleanups done in the core in
this release, we had broken component lookup in the case with a single
bus and DMA controller. Otherwise it's driver specific changes, the
shortlogs for the Intel WCL and rsnd drivers look like minor cleanups
but are actually bugfixes (adding an op needed for correct functionality
and reverting an inappropriate helper usage).
Diffstat (limited to 'rust/kernel/alloc/allocator_test.rs')
-rw-r--r-- | rust/kernel/alloc/allocator_test.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/rust/kernel/alloc/allocator_test.rs b/rust/kernel/alloc/allocator_test.rs index a3074480bd8d..90dd987d40e4 100644 --- a/rust/kernel/alloc/allocator_test.rs +++ b/rust/kernel/alloc/allocator_test.rs @@ -22,6 +22,17 @@ pub type Kmalloc = Cmalloc; pub type Vmalloc = Kmalloc; pub type KVmalloc = Kmalloc; +impl Cmalloc { + /// Returns a [`Layout`] that makes [`Kmalloc`] fulfill the requested size and alignment of + /// `layout`. + pub fn aligned_layout(layout: Layout) -> Layout { + // Note that `layout.size()` (after padding) is guaranteed to be a multiple of + // `layout.align()` which together with the slab guarantees means that `Kmalloc` will return + // a properly aligned object (see comments in `kmalloc()` for more information). + layout.pad_to_align() + } +} + extern "C" { #[link_name = "aligned_alloc"] fn libc_aligned_alloc(align: usize, size: usize) -> *mut crate::ffi::c_void; |