On Mon Nov 30, 2026 at 12:11 AM JST, Alexandre Courbot wrote:
> From: John Hubbard <[email protected]>
>
> With the r000 firmware, GSP-RM reports the static GPU configuration in
> its reply to GSP_INIT, a GMC command, and no RPC command fetches it.
>
> The type that holds the configuration is named after the r570 RPC
> command that fetches it, and it is defined among the RPC commands.
>
> In order to make the type available to a GMC reply, name it after its
> contents, and move it out of the RPC commands, up into the commands
> module.
>
> No functional changes.
>
> Signed-off-by: John Hubbard <[email protected]>
> Signed-off-by: Alexandre Courbot <[email protected]>
> ---

[...]

> +#[derive(Debug)]
> +pub enum GpuNameError {
> +    /// The GPU name string does not contain a null terminator.
> +    NoNullTerminator(FromBytesUntilNulError),
> +
> +    /// The GPU name string contains invalid UTF-8.
> +    InvalidUtf8(Utf8Error),
> +}
> +
> +impl GspStaticInfo {
> +    /// Returns the name of the GPU as a string.
> +    ///
> +    /// Returns an error if the string given by the GSP does not contain a 
> null terminator or
> +    /// contains invalid UTF-8.
> +    pub fn gpu_name(&self) -> Result<&str, GpuNameError> {
> +        CStr::from_bytes_until_nul(&self.gpu_name)
> +            .map_err(GpuNameError::NoNullTerminator)?
> +            .to_str()
> +            .map_err(GpuNameError::InvalidUtf8)
> +    }
> +
> +    /// Returns the short name of the GPU as a string.
> +    ///
> +    /// Returns an error if the string given by the GSP does not contain a 
> null terminator or
> +    /// contains invalid UTF-8.
> +    pub fn gpu_short_name(&self) -> core::result::Result<&str, GpuNameError> 
> {

nit: while you are here, use Result not core::result::Result ?

Reviewed-by: Eliot Courtney <[email protected]>

Reply via email to