smc: make SmcRegisters explicitly !Send and !Sync The handle owns one hardware controller exclusively. Replace the misleading `PhantomData<UnsafeCell<()>>` marker (commented "allow Send") with `PhantomData<*const ()>` so the type is both !Send and !Sync, preventing the handle from being moved across threads or into an ISR where it could alias the controller it owns. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
diff --git a/target/ast10x0/peripherals/smc/registers.rs b/target/ast10x0/peripherals/smc/registers.rs index f629249..084a2de 100644 --- a/target/ast10x0/peripherals/smc/registers.rs +++ b/target/ast10x0/peripherals/smc/registers.rs
@@ -19,7 +19,6 @@ //! The controller layer answers "what to do with the data based on the topology." use ast1060_pac as device; -use core::cell::UnsafeCell; use core::marker::PhantomData; use crate::smc::helpers::{ @@ -35,7 +34,11 @@ /// hex offsets (e.g., `fmc000()` for offset 0x00, `fmc080()` for offset 0x80). pub struct SmcRegisters { base: *const device::fmc::RegisterBlock, - _not_sync: PhantomData<UnsafeCell<()>>, // Prevent Sync, allow Send + // `*const ()` marker keeps the handle `!Send` and `!Sync`. An `SmcRegisters` + // represents exclusive ownership of one hardware controller; it must not be + // shared between threads or moved into another execution context (e.g. an + // ISR) where it could alias the controller it owns. + _not_send_sync: PhantomData<*const ()>, } impl SmcRegisters { @@ -49,7 +52,7 @@ pub const unsafe fn new(base: *const device::fmc::RegisterBlock) -> Self { Self { base, - _not_sync: PhantomData, + _not_send_sync: PhantomData, } }