[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 05/10] rust: qdev: add clock creation
From: |
Zhao Liu |
Subject: |
Re: [PATCH 05/10] rust: qdev: add clock creation |
Date: |
Thu, 6 Feb 2025 16:15:32 +0800 |
> // SAFETY:
> //
> - // self.clock is not initialized at this point; but since
> `NonNull<_>` is Copy,
> - // we can overwrite the undefined value without side effects. This is
> + // self.clock is not initialized at this point; but since
> `NonNull<_>` is
s/NonNull<_>/Owned<_>/
> + // not Drop, we can overwrite the undefined value without side
> effects. This is
> // safe since all PL011State instances are created by QOM code which
> // calls this function to initialize the fields; therefore no code is
> // able to access an invalid self.clock value.
> - unsafe {
> - let dev: &mut DeviceState = self.upcast_mut();
> - self.clock = NonNull::new(qdev_init_clock_in(
> - dev,
> - CLK_NAME.as_ptr(),
> - None, /* pl011_clock_update */
> - addr_of_mut!(*self).cast::<c_void>(),
> - ClockEvent::ClockUpdate.0,
> - ))
> - .unwrap();
> - }
> + self.clock = self.init_clock_in("clk", &Self::clock_update,
> ClockEvent::ClockUpdate);
> + }
> +
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH 05/10] rust: qdev: add clock creation,
Zhao Liu <=