Re: [PATCH v2 2/2] gpu: nova-core: gsp: use () as message type for GspInitDone message
From: Alistair Popple
Date: Mon Dec 08 2025 - 05:56:56 EST
On 2025-12-08 at 20:54 +1100, Alexandre Courbot <acourbot@xxxxxxxxxx> wrote...
> `GspInitDone` has no payload whatsoever, so the unit type `()` is the
> correct way to represent its message content. We can use it now that
> `()` implements `FromBytes`.
Much nicer, thanks.
Reviewed-by: Alistair Popple <apopple@xxxxxxxxxx>
> Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
> ---
> drivers/gpu/nova-core/gsp/commands.rs | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
> index 0425c65b5d6f..2050771f9b53 100644
> --- a/drivers/gpu/nova-core/gsp/commands.rs
> +++ b/drivers/gpu/nova-core/gsp/commands.rs
> @@ -142,7 +142,7 @@ fn init_variable_payload(
> }
>
> /// Message type for GSP initialization done notification.
> -struct GspInitDone {}
> +struct GspInitDone;
>
> // SAFETY: `GspInitDone` is a zero-sized type with no bytes, therefore it
> // trivially has no uninitialized bytes.
> @@ -151,13 +151,13 @@ unsafe impl FromBytes for GspInitDone {}
> impl MessageFromGsp for GspInitDone {
> const FUNCTION: MsgFunction = MsgFunction::GspInitDone;
> type InitError = Infallible;
> - type Message = GspInitDone;
> + type Message = ();
>
> fn read(
> _msg: &Self::Message,
> _sbuffer: &mut SBufferIter<array::IntoIter<&[u8], 2>>,
> ) -> Result<Self, Self::InitError> {
> - Ok(GspInitDone {})
> + Ok(GspInitDone)
> }
> }
>
>
> --
> 2.52.0
>