Skip to content

Commit

Permalink
Merge pull request torvalds#522 from ojeda/clean-warnings
Browse files Browse the repository at this point in the history
Clean warnings
  • Loading branch information
ojeda committed Oct 19, 2021
2 parents 025f1c9 + 6a78f78 commit 4567a2d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions rust/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ rustdoc-macros: $(srctree)/rust/macros/lib.rs FORCE
rustdoc-compiler_builtins: $(srctree)/rust/compiler_builtins.rs rustdoc-core FORCE
$(call if_changed,rustdoc)

# We need to allow `broken_intra_doc_links` because some
# We need to allow `rustdoc::broken_intra_doc_links` because some
# `no_global_oom_handling` functions refer to non-`no_global_oom_handling`
# functions. Ideally `rustdoc` would have a way to distinguish broken links
# due to things that are "configured out" vs. entirely non-existing ones.
rustdoc-alloc: private rustc_target_flags = $(alloc-cfgs) \
-Abroken_intra_doc_links
-Arustdoc::broken_intra_doc_links
rustdoc-alloc: $(srctree)/rust/alloc/lib.rs rustdoc-core \
rustdoc-compiler_builtins FORCE
$(call if_changed,rustdoc)
Expand Down
2 changes: 2 additions & 0 deletions rust/kernel/io_mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//!
//! C header: [`include/asm-generic/io.h`](../../../../include/asm-generic/io.h)

#![allow(dead_code)]

use crate::{bindings, Error, Result};
use core::convert::TryInto;

Expand Down
10 changes: 9 additions & 1 deletion rust/kernel/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ pub use build_error::build_error;
pub use crate::error::{Error, Result};
pub use crate::types::{Mode, ScopeGuard};

use core::marker::PhantomData;

/// Page size defined in terms of the `PAGE_SHIFT` macro from C.
///
/// [`PAGE_SHIFT`]: ../../../include/asm-generic/page.h
Expand Down Expand Up @@ -139,15 +141,21 @@ impl ThisModule {
bindings::kernel_param_lock(self.0)
}

KParamGuard { this_module: self }
KParamGuard {
#[cfg(CONFIG_SYSFS)]
this_module: self,
phantom: PhantomData,
}
}
}

/// Scoped lock on the kernel parameters of [`ThisModule`].
///
/// Lock will be released when this struct is dropped.
pub struct KParamGuard<'a> {
#[cfg(CONFIG_SYSFS)]
this_module: &'a ThisModule,
phantom: PhantomData<&'a ()>,
}

#[cfg(CONFIG_SYSFS)]
Expand Down
2 changes: 2 additions & 0 deletions rust/kernel/power.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//!
//! C header: [`include/linux/pm.h`](../../../../include/linux/pm.h)

#![allow(dead_code)]

use crate::{bindings, c_types, from_kernel_result, sync::Ref, types::PointerWrapper, Result};
use core::{marker::PhantomData, ops::Deref};

Expand Down

0 comments on commit 4567a2d

Please sign in to comment.