Commit 40d32f3411 for qemu.org
commit 40d32f341104b95ec012beacfce4d93ca037d3b0
Author: Emmanuel Blot <emmanuel.blot@free.fr>
Date: Thu Oct 15 11:27:57 2026 +0200
hw/rtc: ds1338: implement Resettable reset
The device relied on device_class_set_legacy_reset(), a compatibility
shim around the legacy DeviceState reset hook. Convert ds1338_reset()
into a proper Resettable hold phase, dropping the legacy shim.
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Emmanuel Blot <emmanuel.blot@free.fr>
Link: https://lore.kernel.org/qemu-devel/20261015-bmc-minerva-v3-10-7d50c8a108e5@free.fr
Signed-off-by: Cédric Le Goater <clg@redhat.com>
diff --git a/hw/rtc/ds1338.c b/hw/rtc/ds1338.c
index f8b3340bf0..74aee6c746 100644
--- a/hw/rtc/ds1338.c
+++ b/hw/rtc/ds1338.c
@@ -208,9 +208,9 @@ static int ds1338_send(I2CSlave *i2c, uint8_t data)
return 0;
}
-static void ds1338_reset(DeviceState *dev)
+static void ds1338_reset_hold(Object *obj, ResetType type)
{
- DS1338State *s = DS1338(dev);
+ DS1338State *s = DS1338(obj);
/* The clock is running and synchronized with the host */
s->offset = 0;
@@ -224,11 +224,12 @@ static void ds1338_class_init(ObjectClass *klass, const void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
I2CSlaveClass *k = I2C_SLAVE_CLASS(klass);
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
k->event = ds1338_event;
k->recv = ds1338_recv;
k->send = ds1338_send;
- device_class_set_legacy_reset(dc, ds1338_reset);
+ rc->phases.hold = ds1338_reset_hold;
dc->vmsd = &vmstate_ds1338;
}