rust/qdev: Make REALIZE safe
authorZhao Liu <zhao1.liu@intel.com>
Tue, 21 Jan 2025 14:04:56 +0000 (22:04 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 23 Jan 2025 10:50:53 +0000 (11:50 +0100)
commit0f9eb0ff2b25787be62fceb036dba7c3f54fde2d
tree525a888f4c0da48be31d36f8a5e9778da13583c3
parent8113dbbcdaee05f319a7e48272416d918cb2b04a
rust/qdev: Make REALIZE safe

A safe REALIZE accepts immutable reference.

Since current PL011's realize() only calls a char binding function (
qemu_chr_fe_set_handlers), it is possible to convert mutable reference
(&mut self) to immutable reference (&self), which only needs to convert
the pointers passed to C to mutable pointers.

Thus, make REALIZE accept immutable reference.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20250121140457.84631-2-zhao1.liu@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
rust/hw/char/pl011/src/device.rs
rust/qemu-api/src/qdev.rs