Fixing various warnings
* Missing and incorrect # Safety comments
* Unused functions and variables
* Refactoring conditional AArch64 compilation
Signed-off-by: Imre Kis <imre.kis@arm.com>
Change-Id: Ie638d1eeb2928a0c6eb0d4eb64c9d19b82f91e4d
diff --git a/src/page_pool.rs b/src/page_pool.rs
index e0b6dc4..c2707c7 100644
--- a/src/page_pool.rs
+++ b/src/page_pool.rs
@@ -69,7 +69,8 @@
/// Get as slice
///
- /// **Unsafe**: The returned slice is created from its address and length which is stored in the
+ /// # Safety
+ /// The returned slice is created from its address and length which is stored in the
/// object. The caller has to ensure that no other references are being used of the pages.
pub unsafe fn get_as_slice<T>(&self) -> &[T] {
assert!((core::mem::align_of::<T>() - 1) & self.pa == 0);
@@ -82,7 +83,8 @@
/// Get as mutable slice
///
- /// **Unsafe**: The returned slice is created from its address and length which is stored in the
+ /// # Safety
+ /// The returned slice is created from its address and length which is stored in the
/// object. The caller has to ensure that no other references are being used of the pages.
pub unsafe fn get_as_mut_slice<T>(&mut self) -> &mut [T] {
assert!((core::mem::align_of::<T>() - 1) & self.pa == 0);
@@ -95,7 +97,8 @@
/// Set contents from slice
///
- /// **Unsafe:** The caller has to ensure that the passed slice is a valid page range.
+ /// # Safety
+ /// The caller has to ensure that the passed slice is a valid page range.
pub unsafe fn from_slice<T>(s: &mut [T]) -> Pages {
Pages {
pa: KernelSpace::kernel_to_pa(s.as_ptr() as u64) as usize,
@@ -231,10 +234,6 @@
pub fn release_pages(&self, pages_to_release: Pages) -> Result<(), PagePoolError> {
self.pages.lock().release(pages_to_release)
}
-
- fn round_up_to_page_size(length: usize) -> usize {
- (length + Page::SIZE - 1) & !(Page::SIZE - 1)
- }
}
#[cfg(test)]