From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Bernhard Beschow" <shentey@gmail.com>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH 2/2] hw/char/sh_serial: Convert to TypeInfo
Date: Fri, 24 Jan 2025 18:50:53 +0100 [thread overview]
Message-ID: <20250124175053.74461-3-philmd@linaro.org> (raw)
In-Reply-To: <20250124175053.74461-1-philmd@linaro.org>
QOM types are now registered using as TypeInfo via DEFINE_TYPES()
or type_init(). Update TYPE_SH_SERIAL, removing the empty QOM
instance_init/finalize handlers.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/char/sh_serial.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c
index 29ac9f9e5e7..b1db91656fe 100644
--- a/hw/char/sh_serial.c
+++ b/hw/char/sh_serial.c
@@ -78,10 +78,6 @@ struct SHSerialState {
qemu_irq bri;
};
-typedef struct {} SHSerialStateClass;
-
-OBJECT_DEFINE_TYPE(SHSerialState, sh_serial, SH_SERIAL, SYS_BUS_DEVICE)
-
static void sh_serial_clear_fifo(SHSerialState *s)
{
memset(s->rx_fifo, 0, SH_RX_FIFO_LENGTH);
@@ -443,14 +439,6 @@ static void sh_serial_unrealize(DeviceState *dev)
timer_del(&s->fifo_timeout_timer);
}
-static void sh_serial_init(Object *obj)
-{
-}
-
-static void sh_serial_finalize(Object *obj)
-{
-}
-
static const Property sh_serial_properties[] = {
DEFINE_PROP_CHR("chardev", SHSerialState, chr),
DEFINE_PROP_UINT8("features", SHSerialState, feat, 0),
@@ -467,3 +455,14 @@ static void sh_serial_class_init(ObjectClass *oc, void *data)
/* Reason: part of SuperH CPU/SoC, needs to be wired up */
dc->user_creatable = false;
}
+
+static const TypeInfo sh_serial_types[] = {
+ {
+ .name = TYPE_SH_SERIAL,
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SHSerialState),
+ .class_init = sh_serial_class_init,
+ },
+};
+
+DEFINE_TYPES(sh_serial_types)
--
2.47.1
next prev parent reply other threads:[~2025-01-24 17:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-24 17:50 [PATCH 0/2] hw/char/sh_serial: QOM housekeeping Philippe Mathieu-Daudé
2025-01-24 17:50 ` [PATCH 1/2] hw/char/sh_serial: Delete fifo_timeout_timer in DeviceUnrealize Philippe Mathieu-Daudé
2025-02-06 14:57 ` Peter Maydell
2025-01-24 17:50 ` Philippe Mathieu-Daudé [this message]
2025-01-24 18:07 ` [PATCH 2/2] hw/char/sh_serial: Convert to TypeInfo Philippe Mathieu-Daudé
2025-02-06 15:07 ` Peter Maydell
2025-02-06 11:55 ` [PATCH 0/2] hw/char/sh_serial: QOM housekeeping Philippe Mathieu-Daudé
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=20250124175053.74461-3-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=magnus.damm@gmail.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=shentey@gmail.com \
--cc=ysato@users.sourceforge.jp \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).