Re: [PATCH FOR REFERENCE v8 10/10] gpu: nova-core: use the kernel `register!` macro
From: Joel Fernandes
Date: Mon Mar 09 2026 - 12:00:45 EST
On 3/9/2026 11:14 AM, Alexandre Courbot wrote:
>
> @@ -797,26 +792,30 @@ pub(crate) fn start(&self, bar: &Bar0) -> Result<()> {
> /// Writes values to the mailbox registers if provided.
> pub(crate) fn write_mailboxes(&self, bar: &Bar0, mbox0: Option<u32>, mbox1: Option<u32>) {
> if let Some(mbox0) = mbox0 {
> - regs::NV_PFALCON_FALCON_MAILBOX0::default()
> - .set_value(mbox0)
> - .write(bar, &E::ID);
> + bar.write(
> + WithBase::of::<E>(),
> + regs::NV_PFALCON_FALCON_MAILBOX0::zeroed().with_value(mbox0),
> + );
> }
>
> if let Some(mbox1) = mbox1 {
> - regs::NV_PFALCON_FALCON_MAILBOX1::default()
> - .set_value(mbox1)
> - .write(bar, &E::ID);
> + bar.write(
> + WithBase::of::<E>(),
> + regs::NV_PFALCON_FALCON_MAILBOX1::zeroed().with_value(mbox1),
> + );
> }
> }
TBH, this is quite a readability hit, the previous was much more readable IMHO.
Why doesn't the previous caller-side syntax still work?
thanks,
--
Joel Fernandes