On Mon Nov 30, 2026 at 12:11 AM JST, Alexandre Courbot wrote:
> From: John Hubbard <[email protected]>
>
> Move the check for retained logs that the GSP never wrote to into a
> helper, so that it stays in one place when buffers are added.
>
> No functional change.
>
> Signed-off-by: John Hubbard <[email protected]>
> Signed-off-by: Alexandre Courbot <[email protected]>
> ---
>  drivers/gpu/nova-core/gsp/logbuffer.rs | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/nova-core/gsp/logbuffer.rs 
> b/drivers/gpu/nova-core/gsp/logbuffer.rs
> index 40fb6682d83d..bfc1712ea458 100644
> --- a/drivers/gpu/nova-core/gsp/logbuffer.rs
> +++ b/drivers/gpu/nova-core/gsp/logbuffer.rs
> @@ -175,7 +175,7 @@ fn retain(&self) -> Result {
>              logrm: self.logrm.snapshot()?,
>          };
>  
> -        if logs.loginit.is_empty() && logs.logintr.is_empty() && 
> logs.logrm.is_empty() {
> +        if logs.is_empty() {
>              return Ok(());
>          }
>  
> @@ -221,6 +221,13 @@ struct RetainedLogBuffers {
>      logrm: VVec<u8>,
>  }
>  
> +impl RetainedLogBuffers {
> +    /// Returns `true` if the GSP never wrote to any of the buffers.
> +    fn is_empty(&self) -> bool {
> +        self.loginit.is_empty() && self.logintr.is_empty() && 
> self.logrm.is_empty()

optional nit: destructure &self (specifying all fields), e.g.:
```
fn is_empty(&self) -> bool {
    let Self {
        name: _,
        loginit,
        logintr,
        logrm,
    } = self;

    loginit.is_empty() && logintr.is_empty() && logrm.is_empty()
}
```

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

Reply via email to