[PATCH 4/9] gpu: nova-core: gsp: remove unneeded sequencer trait

Alexandre Courbot posted 9 patches 1 week, 4 days ago
There is a newer version of this series
[PATCH 4/9] gpu: nova-core: gsp: remove unneeded sequencer trait
Posted by Alexandre Courbot 1 week, 4 days ago
The `GspSeqCmdRunner` trait is never used as we never call the `run`
methods from generic code. Remove it.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/gsp/sequencer.rs | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/sequencer.rs b/drivers/gpu/nova-core/gsp/sequencer.rs
index 2d0369c49092..4efa048b9d93 100644
--- a/drivers/gpu/nova-core/gsp/sequencer.rs
+++ b/drivers/gpu/nova-core/gsp/sequencer.rs
@@ -147,12 +147,7 @@ pub(crate) struct GspSequencer<'a> {
     dev: ARef<device::Device>,
 }
 
-/// Trait for running sequencer commands.
-pub(crate) trait GspSeqCmdRunner {
-    fn run(&self, sequencer: &GspSequencer<'_>) -> Result;
-}
-
-impl GspSeqCmdRunner for fw::RegWritePayload {
+impl fw::RegWritePayload {
     fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
         let addr = usize::from_safe_cast(self.addr());
 
@@ -160,7 +155,7 @@ fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
     }
 }
 
-impl GspSeqCmdRunner for fw::RegModifyPayload {
+impl fw::RegModifyPayload {
     fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
         let addr = usize::from_safe_cast(self.addr());
 
@@ -172,7 +167,7 @@ fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
     }
 }
 
-impl GspSeqCmdRunner for fw::RegPollPayload {
+impl fw::RegPollPayload {
     fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
         let addr = usize::from_safe_cast(self.addr());
 
@@ -197,14 +192,14 @@ fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
     }
 }
 
-impl GspSeqCmdRunner for fw::DelayUsPayload {
+impl fw::DelayUsPayload {
     fn run(&self, _sequencer: &GspSequencer<'_>) -> Result {
         fsleep(Delta::from_micros(i64::from(self.val())));
         Ok(())
     }
 }
 
-impl GspSeqCmdRunner for fw::RegStorePayload {
+impl fw::RegStorePayload {
     fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
         let addr = usize::from_safe_cast(self.addr());
 
@@ -212,7 +207,7 @@ fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
     }
 }
 
-impl GspSeqCmdRunner for GspSeqCmd {
+impl GspSeqCmd {
     fn run(&self, seq: &GspSequencer<'_>) -> Result {
         match self {
             GspSeqCmd::RegWrite(cmd) => cmd.run(seq),

-- 
2.52.0
Re: [PATCH 4/9] gpu: nova-core: gsp: remove unneeded sequencer trait
Posted by lyude@redhat.com 1 week ago
Reviewed-by: Lyude Paul <lyude@redhat.com>

On Mon, 2025-12-08 at 18:26 +0900, Alexandre Courbot wrote:
> The `GspSeqCmdRunner` trait is never used as we never call the `run`
> methods from generic code. Remove it.
> 
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
>  drivers/gpu/nova-core/gsp/sequencer.rs | 17 ++++++-----------
>  1 file changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/nova-core/gsp/sequencer.rs
> b/drivers/gpu/nova-core/gsp/sequencer.rs
> index 2d0369c49092..4efa048b9d93 100644
> --- a/drivers/gpu/nova-core/gsp/sequencer.rs
> +++ b/drivers/gpu/nova-core/gsp/sequencer.rs
> @@ -147,12 +147,7 @@ pub(crate) struct GspSequencer<'a> {
>      dev: ARef<device::Device>,
>  }
>  
> -/// Trait for running sequencer commands.
> -pub(crate) trait GspSeqCmdRunner {
> -    fn run(&self, sequencer: &GspSequencer<'_>) -> Result;
> -}
> -
> -impl GspSeqCmdRunner for fw::RegWritePayload {
> +impl fw::RegWritePayload {
>      fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
>          let addr = usize::from_safe_cast(self.addr());
>  
> @@ -160,7 +155,7 @@ fn run(&self, sequencer: &GspSequencer<'_>) ->
> Result {
>      }
>  }
>  
> -impl GspSeqCmdRunner for fw::RegModifyPayload {
> +impl fw::RegModifyPayload {
>      fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
>          let addr = usize::from_safe_cast(self.addr());
>  
> @@ -172,7 +167,7 @@ fn run(&self, sequencer: &GspSequencer<'_>) ->
> Result {
>      }
>  }
>  
> -impl GspSeqCmdRunner for fw::RegPollPayload {
> +impl fw::RegPollPayload {
>      fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
>          let addr = usize::from_safe_cast(self.addr());
>  
> @@ -197,14 +192,14 @@ fn run(&self, sequencer: &GspSequencer<'_>) ->
> Result {
>      }
>  }
>  
> -impl GspSeqCmdRunner for fw::DelayUsPayload {
> +impl fw::DelayUsPayload {
>      fn run(&self, _sequencer: &GspSequencer<'_>) -> Result {
>          fsleep(Delta::from_micros(i64::from(self.val())));
>          Ok(())
>      }
>  }
>  
> -impl GspSeqCmdRunner for fw::RegStorePayload {
> +impl fw::RegStorePayload {
>      fn run(&self, sequencer: &GspSequencer<'_>) -> Result {
>          let addr = usize::from_safe_cast(self.addr());
>  
> @@ -212,7 +207,7 @@ fn run(&self, sequencer: &GspSequencer<'_>) ->
> Result {
>      }
>  }
>  
> -impl GspSeqCmdRunner for GspSeqCmd {
> +impl GspSeqCmd {
>      fn run(&self, seq: &GspSequencer<'_>) -> Result {
>          match self {
>              GspSeqCmd::RegWrite(cmd) => cmd.run(seq),