rust: do not use TYPE_CHARDEV unnecessarily
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 15 Oct 2024 12:46:42 +0000 (14:46 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 5 Nov 2024 13:18:16 +0000 (14:18 +0100)
In the invocation of qdev_prop_set_chr(), "chardev" is the name of a
property rather than a type and has to match the name of the property
in device_class.rs.  Do not use TYPE_CHARDEV here, just like in the C
version of pl011_create.

Reviewed-by: Junjie Mao <junjie.mao@hotmail.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
rust/hw/char/pl011/src/device.rs

index 0347a027c5f71c17c2d2c2582c495960c670e88c..b3d8bc004e09bf9dbca1ce065a51a95bf8d8dd1c 100644 (file)
@@ -573,7 +573,7 @@ pub unsafe extern "C" fn pl011_create(
         let dev: *mut DeviceState = qdev_new(PL011State::TYPE_INFO.name);
         let sysbus: *mut SysBusDevice = dev.cast::<SysBusDevice>();
 
-        qdev_prop_set_chr(dev, bindings::TYPE_CHARDEV.as_ptr(), chr);
+        qdev_prop_set_chr(dev, c"chardev".as_ptr(), chr);
         sysbus_realize_and_unref(sysbus, addr_of!(error_fatal) as *mut *mut Error);
         sysbus_mmio_map(sysbus, 0, addr);
         sysbus_connect_irq(sysbus, 0, irq);