On 10/12/26 16:32, Emmanuel Blot wrote:
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.
Signed-off-by: Emmanuel Blot <[email protected]>
---
hw/rtc/ds1338.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
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;
}
Reviewed-by: Cédric Le Goater <[email protected]>
Thanks,
C.