rust: devres: fix doctest build under `!CONFIG_PCI`
authorMiguel Ojeda <ojeda@kernel.org>
Sun, 11 May 2025 18:25:33 +0000 (20:25 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Mon, 12 May 2025 07:35:44 +0000 (09:35 +0200)
commit42055939a3a4cac8afbebff85a29571c2bd3238c
treee4dffd24ff1c0b118f52a574ead613696985d8ed
parentb75a99e1077b12c5631fef7ac36970a89f6021f7
rust: devres: fix doctest build under `!CONFIG_PCI`

The doctest requires `CONFIG_PCI`:

    error[E0432]: unresolved import `kernel::pci`
        --> rust/doctests_kernel_generated.rs:2689:44
         |
    2689 | use kernel::{device::Core, devres::Devres, pci};
         |                                            ^^^ no `pci` in the root
         |
    note: found an item that was configured out
        --> rust/kernel/lib.rs:96:9
    note: the item is gated here
        --> rust/kernel/lib.rs:95:1

Thus conditionally compile it (which still checks the syntax).

Fixes: f301cb978c06 ("rust: devres: implement Devres::access()")
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://lore.kernel.org/r/20250511182533.1016163-1-ojeda@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/devres.rs