* [PATCH 1/3] hw/sensor/dps310: Convert to Resettable interface
2026-12-01 15:16 [PATCH 0/3] hw/sensor: Convert I2C sensor devices to Resettable interface Oscar Alejandro Sánchez Lucero
@ 2026-12-01 15:16 ` Oscar Alejandro Sánchez Lucero
2026-12-01 15:16 ` [PATCH 2/3] hw/sensor/emc141x: " Oscar Alejandro Sánchez Lucero
2026-12-01 15:16 ` [PATCH 3/3] hw/sensor/lsm303dlhc_mag: " Oscar Alejandro Sánchez Lucero
2 siblings, 0 replies; 4+ messages in thread
From: Oscar Alejandro Sánchez Lucero @ 2026-12-01 15:16 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Oscar Alejandro Sánchez Lucero
Replace the deprecated device_class_set_legacy_reset() with the
Resettable interface by implementing the hold phase in
dps310_reset_hold().
Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
hw/sensor/dps310.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/sensor/dps310.c b/hw/sensor/dps310.c
index bcf6154..8dce3bf 100644
--- a/hw/sensor/dps310.c
+++ b/hw/sensor/dps310.c
@@ -56,9 +56,9 @@ typedef struct DPS310State {
#define DPS310_COEF_LAST 0x21
#define DPS310_COEF_SRC 0x28
-static void dps310_reset(DeviceState *dev)
+static void dps310_reset_hold(Object *obj, ResetType type)
{
- DPS310State *s = DPS310(dev);
+ DPS310State *s = DPS310(obj);
static const uint8_t regs_reset_state[sizeof(s->regs)] = {
0xfe, 0x2f, 0xee, 0x02, 0x69, 0xa6, 0x00, 0x80, 0xc7, 0x00, 0x00, 0x00,
@@ -201,11 +201,12 @@ static void dps310_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 = dps310_event;
k->recv = dps310_rx;
k->send = dps310_tx;
- device_class_set_legacy_reset(dc, dps310_reset);
+ rc->phases.hold = dps310_reset_hold;
dc->vmsd = &vmstate_dps310;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/3] hw/sensor/emc141x: Convert to Resettable interface
2026-12-01 15:16 [PATCH 0/3] hw/sensor: Convert I2C sensor devices to Resettable interface Oscar Alejandro Sánchez Lucero
2026-12-01 15:16 ` [PATCH 1/3] hw/sensor/dps310: Convert " Oscar Alejandro Sánchez Lucero
@ 2026-12-01 15:16 ` Oscar Alejandro Sánchez Lucero
2026-12-01 15:16 ` [PATCH 3/3] hw/sensor/lsm303dlhc_mag: " Oscar Alejandro Sánchez Lucero
2 siblings, 0 replies; 4+ messages in thread
From: Oscar Alejandro Sánchez Lucero @ 2026-12-01 15:16 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Oscar Alejandro Sánchez Lucero
Replace the deprecated device_class_set_legacy_reset() with the
Resettable interface by implementing the hold phase in
emc141x_reset_hold().
Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
hw/sensor/emc141x.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/sensor/emc141x.c b/hw/sensor/emc141x.c
index f53ee9f..d183fae 100644
--- a/hw/sensor/emc141x.c
+++ b/hw/sensor/emc141x.c
@@ -238,9 +238,9 @@ static const VMStateDescription vmstate_emc141x = {
}
};
-static void emc141x_reset(DeviceState *dev)
+static void emc141x_reset_hold(Object *obj, ResetType type)
{
- EMC141XState *s = EMC141X(dev);
+ EMC141XState *s = EMC141X(obj);
int i;
for (i = 0; i < SENSORS_COUNT_MAX; i++) {
@@ -270,8 +270,9 @@ static void emc141x_class_init(ObjectClass *klass, const void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
I2CSlaveClass *k = I2C_SLAVE_CLASS(klass);
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
- device_class_set_legacy_reset(dc, emc141x_reset);
+ rc->phases.hold = emc141x_reset_hold;
k->event = emc141x_event;
k->recv = emc141x_rx;
k->send = emc141x_tx;
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 3/3] hw/sensor/lsm303dlhc_mag: Convert to Resettable interface
2026-12-01 15:16 [PATCH 0/3] hw/sensor: Convert I2C sensor devices to Resettable interface Oscar Alejandro Sánchez Lucero
2026-12-01 15:16 ` [PATCH 1/3] hw/sensor/dps310: Convert " Oscar Alejandro Sánchez Lucero
2026-12-01 15:16 ` [PATCH 2/3] hw/sensor/emc141x: " Oscar Alejandro Sánchez Lucero
@ 2026-12-01 15:16 ` Oscar Alejandro Sánchez Lucero
2 siblings, 0 replies; 4+ messages in thread
From: Oscar Alejandro Sánchez Lucero @ 2026-12-01 15:16 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Oscar Alejandro Sánchez Lucero
Replace the deprecated device_class_set_legacy_reset() with the
Resettable interface by implementing the hold phase in
lsm303dlhc_mag_reset_hold().
Signed-off-by: Oscar Alejandro Sánchez Lucero <aleszlucero@gmail.com>
---
hw/sensor/lsm303dlhc_mag.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/sensor/lsm303dlhc_mag.c b/hw/sensor/lsm303dlhc_mag.c
index 1045473..7abb618 100644
--- a/hw/sensor/lsm303dlhc_mag.c
+++ b/hw/sensor/lsm303dlhc_mag.c
@@ -496,10 +496,9 @@ static void lsm303dlhc_mag_default_cfg(LSM303DLHCMagState *s)
/*
* Callback handler when DeviceState 'reset' is set to true.
*/
-static void lsm303dlhc_mag_reset(DeviceState *dev)
+static void lsm303dlhc_mag_reset_hold(Object *obj, ResetType type)
{
- I2CSlave *i2c = I2C_SLAVE(dev);
- LSM303DLHCMagState *s = LSM303DLHC_MAG(i2c);
+ LSM303DLHCMagState *s = LSM303DLHC_MAG(obj);
/* Set the device into its default reset state. */
lsm303dlhc_mag_default_cfg(s);
@@ -534,8 +533,9 @@ static void lsm303dlhc_mag_class_init(ObjectClass *klass, const void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
I2CSlaveClass *k = I2C_SLAVE_CLASS(klass);
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
- device_class_set_legacy_reset(dc, lsm303dlhc_mag_reset);
+ rc->phases.hold = lsm303dlhc_mag_reset_hold;
dc->vmsd = &vmstate_lsm303dlhc_mag;
k->event = lsm303dlhc_mag_event;
k->recv = lsm303dlhc_mag_recv;
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread