On Thu Mar 5, 2026 at 10:36 AM JST, Eliot Courtney wrote: > On Wed Mar 4, 2026 at 8:57 PM JST, Alexandre Courbot wrote: >> On Wed Mar 4, 2026 at 11:46 AM JST, Eliot Courtney wrote: >>> Wrap `Cmdq`'s mutable state in a new struct `CmdqInner` and wrap that in >>> a Mutex. This lets `Cmdq` methods take &self instead of &mut self, which >>> lets required commands be sent e.g. while unloading the driver. >>> >>> The mutex is held over both send and receive in `send_command` to make >>> sure that it doesn't get the reply of some other command that could have >>> been sent just beforehand. >>> >>> Reviewed-by: Zhi Wang <[email protected]> >>> Tested-by: Zhi Wang <[email protected]> >>> Signed-off-by: Eliot Courtney <[email protected]> >>> --- >>> drivers/gpu/nova-core/gsp/boot.rs | 8 +- >>> drivers/gpu/nova-core/gsp/cmdq.rs | 247 >>> +++++++++++++++++++-------------- >>> drivers/gpu/nova-core/gsp/commands.rs | 4 +- >>> drivers/gpu/nova-core/gsp/sequencer.rs | 2 +- >>> 4 files changed, 146 insertions(+), 115 deletions(-) >> >> Most of the diff is code moving around. I've been able to reduce it to >> +107 -76 by moving `CmdqInner` *after* `Cmdq` - this makes this patch >> easier to review imho. > > Thanks, will move this then since I think the ordering here is probably > not too important to readability.
Yes, actually one could even argue in favor of having the public struct before its inner private counterpart for readability purposes.
