aboutsummaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/vec_ext.rs
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2024-07-10 23:05:45 +0100
committerMark Brown <broonie@kernel.org>2024-07-10 23:05:45 +0100
commit450a60ef607900bb9affb0e822fea9726679c512 (patch)
tree5ec688eeae9b1d713ef3028df03bc9e155d171dd /rust/kernel/alloc/vec_ext.rs
parentf21711bbdbf0d95a389bfaad54ce444b46830d58 (diff)
parent3c1ff93b4deea502cd8b0869839557cab2a28b71 (diff)
regmap: Implement regmap_multi_reg_read()
Merge series from Guenter Roeck <linux@roeck-us.net>: regmap_multi_reg_read() is similar to regmap_bilk_read() but reads from an array of non-sequential registers. It is helpful if multiple non- sequential registers need to be read in a single operation which would otherwise have to be mutex protected. The name of the new function was chosen to match the existing function regmap_multi_reg_write().
Diffstat (limited to 'rust/kernel/alloc/vec_ext.rs')
-rw-r--r--rust/kernel/alloc/vec_ext.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/rust/kernel/alloc/vec_ext.rs b/rust/kernel/alloc/vec_ext.rs
index e9a81052728a..1297a4be32e8 100644
--- a/rust/kernel/alloc/vec_ext.rs
+++ b/rust/kernel/alloc/vec_ext.rs
@@ -4,7 +4,6 @@
use super::{AllocError, Flags};
use alloc::vec::Vec;
-use core::ptr;
/// Extensions to [`Vec`].
pub trait VecExt<T>: Sized {
@@ -141,7 +140,11 @@ impl<T> VecExt<T> for Vec<T> {
// `krealloc_aligned`. A `Vec<T>`'s `ptr` value is not guaranteed to be NULL and might be
// dangling after being created with `Vec::new`. Instead, we can rely on `Vec<T>`'s capacity
// to be zero if no memory has been allocated yet.
- let ptr = if cap == 0 { ptr::null_mut() } else { old_ptr };
+ let ptr = if cap == 0 {
+ core::ptr::null_mut()
+ } else {
+ old_ptr
+ };
// SAFETY: `ptr` is valid because it's either NULL or comes from a previous call to
// `krealloc_aligned`. We also verified that the type is not a ZST.