8000 rust: Use consistent "# Examples" heading style in rustdoc · Rust-for-Linux/linux@b698508 · GitHub
[go: up one dir, main page]

Skip to content

Commit b698508

Browse files
vireshkojeda
authored andcommitted
rust: Use consistent "# Examples" heading style in rustdoc
Use a consistent `# Examples` heading in rustdoc across the codebase. Some modules previously used `## Examples` (even when they should be available as top-level headers), while others used `# Example`, which deviates from the preferred `# Examples` style. Suggested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Benno Lossin <lossin@kernel.org> Link: https://lore.kernel.org/r/ddd5ce0ac20c99a72a4f1e4322d3de3911056922.1749545815.git.viresh.kumar@linaro.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent bfb9e46 commit b698508

File tree

13 files changed

+29
-29
lines changed

13 files changed

+29
-29
lines changed

rust/kernel/block/mq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
//! [`GenDiskBuilder`]: gen_disk::GenDiskBuilder
5454
//! [`GenDiskBuilder::build`]: gen_disk::GenDiskBuilder::build
5555
//!
56-
//! # Example
56+
//! # Examples
5757
//!
5858
//! ```rust
5959
//! use kernel::{

rust/kernel/clk.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::ffi::c_ulong;
1212
///
1313
/// Represents a frequency in hertz, wrapping a [`c_ulong`] value.
1414
///
15-
/// ## Examples
15+
/// # Examples
1616
///
1717
/// ```
1818
/// use kernel::clk::Hertz;
@@ -95,7 +95,7 @@ mod common_clk {
9595
/// Instances of this type are reference-counted. Calling [`Clk::get`] ensures that the
9696
/// allocation remains valid for the lifetime of the [`Clk`].
9797
///
98-
/// ## Examples
98+
/// # Examples
9999
///
100100
/// The following example demonstrates how to obtain and configure a clock for a device.
101101
///
@@ -266,7 +266,7 @@ mod common_clk {
266266
/// Instances of this type are reference-counted. Calling [`OptionalClk::get`] ensures that the
267267
/// allocation remains valid for the lifetime of the [`OptionalClk`].
268268
///
269-
/// ## Examples
269+
/// # Examples
270270
///
271271
/// The following example demonstrates how to obtain and configure an optional clock for a
272272
/// device. The code functions correctly whether or not the clock is available.

rust/kernel/configfs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//!
1818
//! C header: [`include/linux/configfs.h`](srctree/include/linux/configfs.h)
1919
//!
20-
//! # Example
20+
//! # Examples
2121
//!
2222
//! ```ignore
2323
//! use kernel::alloc::flags;

rust/kernel/cpufreq.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl From<TableIndex> for usize {
202202
/// The callers must ensure that the `struct cpufreq_frequency_table` is valid for access and
203203
/// remains valid for the lifetime of the returned reference.
204204
///
205-
/// ## Examples
205+
/// # Examples
206206
///
207207
/// The following example demonstrates how to read a frequency value from [`Table`].
208208
///
@@ -318,7 +318,7 @@ impl Deref for TableBox {
318318
///
319319
/// This is used by the CPU frequency drivers to build a frequency table dynamically.
320320
///
321-
/// ## Examples
321+
/// # Examples
322322
///
323323
/// The following example demonstrates how to create a CPU frequency table.
324324
///
@@ -395,7 +395,7 @@ impl TableBuilder {
395395
/// The callers must ensure that the `struct cpufreq_policy` is valid for access and remains valid
396396
/// for the lifetime of the returned reference.
397397
///
398-
/// ## Examples
398+
/// # Examples
399399
///
400400
/// The following example demonstrates how to create a CPU frequency table.
401401
///
@@ -834,7 +834,7 @@ pub trait Driver {
834834

835835
/// CPU frequency driver Registration.
836836
///
837-
/// ## Examples
837+
/// # Examples
838838
///
839839
/// The following example demonstrates how to register a cpufreq driver.
840840
///

rust/kernel/cpumask.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use core::ops::{Deref, DerefMut};
3030
/// The callers must ensure that the `struct cpumask` is valid for access and
3131
/// remains valid for the lifetime of the returned reference.
3232
///
33-
/// ## Examples
33+
/// # Examples
3434
///
3535
/// The following example demonstrates how to update a [`Cpumask`].
3636
///
@@ -175,7 +175,7 @@ impl Cpumask {
175175
/// The callers must ensure that the `struct cpumask_var_t` is valid for access and remains valid
176176
/// for the lifetime of [`CpumaskVar`].
177177
///
178-
/// ## Examples
178+
/// # Examples
179179
///
180180
/// The following example demonstrates how to create and update a [`CpumaskVar`].
181181
///

rust/kernel/devres.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct DevresInner<T> {
4444
/// [`Devres`] users should make sure to simply free the corresponding backing resource in `T`'s
4545
/// [`Drop`] implementation.
4646
///
47-
/// # Example
47+
/// # Examples
4848
///
4949
/// ```no_run
5050
/// # use kernel::{bindings, c_str, device::{Bound, Device}, devres::Devres, io::{Io, IoRaw}};
@@ -203,7 +203,7 @@ impl<T> Devres<T> {
203203
/// An error is returned if `dev` does not match the same [`Device`] this [`Devres`] instance
204204
/// has been created with.
205205
///
206-
/// # Example
206+
/// # Examples
207207
///
208208
/// ```no_run
209209
/// # #![cfg(CONFIG_PCI)]

rust/kernel/firmware.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ unsafe impl Sync for Firmware {}
140140
/// Typically, such contracts would be enforced by a trait, however traits do not (yet) support
141141
/// const functions.
142142
///
143-
/// # Example
143+
/// # Examples
144144
///
145145
/// ```
146146
/// # mod module_firmware_test {
@@ -262,7 +262,7 @@ impl<const N: usize> ModInfoBuilder<N> {
262262
/// Append path components to the [`ModInfoBuilder`] instance. Paths need to be separated
263263
/// with [`ModInfoBuilder::new_entry`].
264264
///
265-
/// # Example
265+
/// # Examples
266266
///
267267
/// ```
268268
/// use kernel::firmware::ModInfoBuilder;

rust/kernel/opp.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fn to_c_str_array(names: &[CString]) -> Result<KVec<*const u8>> {
103103
///
104104
/// Represents voltage in microvolts, wrapping a [`c_ulong`] value.
105105
///
106-
/// ## Examples
106+
/// # Examples
107107
///
108108
/// ```
109109
/// use kernel::opp::MicroVolt;
@@ -128,7 +128,7 @@ impl From<MicroVolt> for c_ulong {
128128
///
129129
/// Represents power in microwatts, wrapping a [`c_ulong`] value.
130130
///
131-
/// ## Examples
131+
/// # Examples
132132
///
133133
/// ```
134134
/// use kernel::opp::MicroWatt;
@@ -153,7 +153,7 @@ impl From<MicroWatt> for c_ulong {
153153
///
154154
/// The associated [`OPP`] is automatically removed when the [`Token`] is dropped.
155155
///
156-
/// ## Examples
156+
/// # Examples
157157
///
158158
/// The following example demonstrates how to create an [`OPP`] dynamically.
159159
///
@@ -202,7 +202,7 @@ impl Drop for Token {
202202
/// Rust abstraction for the C `struct dev_pm_opp_data`, used to define operating performance
203203
/// points (OPPs) dynamically.
204204
///
205-
/// ## Examples
205+
/// # Examples
206206
///
207207
/// The following example demonstrates how to create an [`OPP`] with [`Data`].
208208
///
@@ -254,7 +254,7 @@ impl Data {
254254

255255
/// [`OPP`] search options.
256256
///
257-
/// ## Examples
257+
/// # Examples
258258
///
259259
/// Defines how to search for an [`OPP`] in a [`Table`] relative to a frequency.
260260
///
@@ -326,7 +326,7 @@ impl Drop for ConfigToken {
326326
///
327327
/// Rust abstraction for the C `struct dev_pm_opp_config`.
328328
///
329-
/// ## Examples
329+
/// # Examples
330330
///
331331
/// The following example demonstrates how to set OPP property-name configuration for a [`Device`].
332332
///
@@ -569,7 +569,7 @@ impl<T: ConfigOps + Default> Config<T> {
569569
///
570570
/// Instances of this type are reference-counted.
571571
///
572-
/// ## Examples
572+
/// # Examples
573573
///
574574
/// The following example demonstrates how to get OPP [`Table`] for a [`Cpumask`] and set its
575575
/// frequency.
@@ -1011,7 +1011,7 @@ impl Drop for Table {
10111011
///
10121012
/// A reference to the [`OPP`], &[`OPP`], isn't refcounted by the Rust code.
10131013
///
1014-
/// ## Examples
1014+
/// # Examples
10151015
///
10161016
/// The following example demonstrates how to get [`OPP`] corresponding to a frequency value and
10171017
/// configure the device with it.

rust/kernel/pci.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<T: Driver + 'static> Adapter<T> {
100100

101101
/// Declares a kernel module that exposes a single PCI driver.
102102
///
103-
/// # Example
103+
/// # Examples
104104
///
105105
///```ignore
106106
/// kernel::module_pci_driver! {
@@ -194,7 +194,7 @@ macro_rules! pci_device_table {
194194

195195
/// The PCI driver trait.
196196
///
197-
/// # Example
197+
/// # Examples
198198
///
199199
///```
200200
/// # use kernel::{bindings, device::Core, pci};

rust/kernel/platform.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ macro_rules! module_platform_driver {
122122
///
123123
/// Drivers must implement this trait in order to get a platform driver registered.
124124
///
125-
/// # Example
125+
/// # Examples
126126
///
127127
///```
128128
/// # use kernel::{bindings, c_str, device::Core, of, platform};

rust/kernel/sync.rs

Lines changed: 1 addition & 1 deletion
E741
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl LockClassKey {
4141
/// Initializes a dynamically allocated lock class key. In the common case of using a
4242
/// statically allocated lock class key, the static_lock_class! macro should be used instead.
4343
///
44-
/// # Example
44+
/// # Examples
4545
/// ```
4646
/// # use kernel::c_str;
4747
/// # use kernel::alloc::KBox;

rust/kernel/workqueue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
//! * The [`WorkItemPointer`] trait is implemented for the pointer type that points at a something
2727
//! that implements [`WorkItem`].
2828
//!
29-
//! ## Example
29+
//! ## Examples
3030
//!
3131
//! This example defines a struct that holds an integer and can be scheduled on the workqueue. When
3232
//! the struct is executed, it will print the integer. Since there is only one `work_struct` field,

rust/pin-init/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ macro_rules! try_init {
953953
/// Asserts that a field on a struct using `#[pin_data]` is marked with `#[pin]` ie. that it is
954954
/// structurally pinned.
955955
///
956-
/// # Example
956+
/// # Examples
957957
///
958958
/// This will succeed:
959959
/// ```

0 commit comments

Comments
 (0)
0