From: "Oscar Alejandro Sánchez Lucero" <aleszlucero@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
"Oscar Alejandro Sánchez Lucero" <aleszlucero@gmail.com>
Subject: [PATCH 1/3] hw/sensor/dps310: Convert to Resettable interface
Date: Tue, 01 Dec 2026 15:16:48 +0000 [thread overview]
Message-ID: <20261201-sensor-resettable-v1-1-497c3be8ae80@gmail.com> (raw)
In-Reply-To: <20261201-sensor-resettable-v1-0-497c3be8ae80@gmail.com>
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
next prev parent reply other threads:[~2026-12-01 15:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2026-12-01 15:16 ` [PATCH 2/3] hw/sensor/emc141x: Convert " Oscar Alejandro Sánchez Lucero
2026-12-01 15:16 ` [PATCH 3/3] hw/sensor/lsm303dlhc_mag: " Oscar Alejandro Sánchez Lucero
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201-sensor-resettable-v1-1-497c3be8ae80@gmail.com \
--to=aleszlucero@gmail.com \
--cc=philmd@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.