Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] Missing standard bus device infrastructure for `faux::Device` 
(`AlwaysRefCounted`, `Send`, `Sync`, `impl_device_context_deref!`, 
`impl_device_context_into_aref!`).
--

commit e85bef2071c929034918bb94467777aee21de70f
Author: Danilo Krummrich <[email protected]>

rust: faux: add Device type with AsBusDevice support

This commit introduces a faux::Device type wrapping struct faux_device and
implements AsBusDevice for it. This allows faux devices to be used as parent
devices for subsystems that require a bus device like DRM.

> diff --git a/rust/kernel/faux.rs b/rust/kernel/faux.rs
> index 36c92ae2943c0..cd0724af446be 100644
> --- a/rust/kernel/faux.rs
> +++ b/rust/kernel/faux.rs

[ ... ]

> +/// A faux device.
> +///
> +/// A faux device is a virtual device backed by the faux bus, primarily used 
> for scenarios where a
> +/// real hardware device is not available or for testing.
> +///
> +/// # Invariants
> +///
> +/// The underlying `struct faux_device` is valid and the embedded `struct 
> device` is initialized.
> +#[repr(transparent)]
> +pub struct Device<Ctx: device::DeviceContext = device::Normal>(
> +    Opaque<bindings::faux_device>,
> +    PhantomData<Ctx>,
> +);

[Severity: Low]
Is faux::Device missing the standard bus device infrastructure here?

Since it wraps Opaque (which is neither Send nor Sync by default), should
this type explicitly implement Send and Sync so that it can be safely shared
across threads?

Additionally, to fully participate in the standard device context and
reference counting hierarchy, should this also implement AlwaysRefCounted and
use the standard device macros (impl_device_context_deref! and
impl_device_context_into_aref!)?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=3

Reply via email to