> > unsafe { > > qdev_init_gpio_in( > > self.upcast::<DeviceState>() as *const DeviceState as *mut > > DeviceState, > > I think you can use self.as_mut_ptr::<DeviceState>() or something like that.
Yes, thank you! > > > assert!(pins.len() > 0); > > !pins.is_empty(). Yes. > But I am not sure it's needed... > > > > unsafe { > > qdev_init_gpio_out( > > self.upcast::<DeviceState>() as *const DeviceState as *mut > > DeviceState, > > pins[0].as_ptr(), > > pins.len() as c_int, > > ... if you use instead pins.as_ptr() without the initial dereference. Emm, pins.as_ptr() returns `*const InterruptSource`, which can't be converted to `*mut *mut IRQState` with InterruptSource::as_ptr(). So I haven't thought of a better way yet... > > impl HPETState { > > ... > > > > fn handle_legacy_irq(&self, irq: u32, level: u32) { > > if irq == HPET_LEGACY_PIT_INT { > > if !self.is_legacy_mode() { > > self.irqs[0].set(level != 0); > > } > > } else { > > self.rtc_irq_level.set(level as u8); > > Any reason why you defined rtc_irq_level as InterruptSource<u8> > instead of InterruptSource<u32>? Thanks! I missed to clean up this, having previously used u8. Regards, Zhao