]> www.infradead.org Git - users/jedix/linux-maple.git/commit
rust: pci: impl TryFrom<&Device> for &pci::Device
authorDanilo Krummrich <dakr@kernel.org>
Fri, 21 Mar 2025 21:47:54 +0000 (22:47 +0100)
committerDanilo Krummrich <dakr@kernel.org>
Sat, 19 Apr 2025 08:20:16 +0000 (10:20 +0200)
commita095d0d1e4849ee25c28d43d713a8f433d7f1f27
tree8e38d36066ae4862f6e297614a485d3096728393
parentcfec9a16e6800b5489bd361f6b6ea9af65fb1050
rust: pci: impl TryFrom<&Device> for &pci::Device

Implement TryFrom<&device::Device> for &Device.

This allows us to get a &pci::Device from a generic &Device in a safe
way; the conversion fails if the device' bus type does not match with
the PCI bus type.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
Link: https://lore.kernel.org/r/20250321214826.140946-3-dakr@kernel.org
[ Support device context types, use dev_is_pci() helper. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/helpers/pci.c
rust/kernel/pci.rs