From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrange" <berrange@redhat.com>,
Juan Quintela <quintela@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH for-6.2 02/12] qom: Use DEVICE_*CLASS instead of OBJECT_*CLASS
Date: Fri, 6 Aug 2021 17:11:17 -0400 [thread overview]
Message-ID: <20210806211127.646908-3-ehabkost@redhat.com> (raw)
In-Reply-To: <20210806211127.646908-1-ehabkost@redhat.com>
There are multiple functions where OBJECT_GET_CLASS or
OBJECT_CLASS_CHECK are being used directly for
DeviceClass/TYPE_DEVICE, instead of the DEVICE_GET_CLASS or
DEVICE_CLASS wrappers. There's no reason to not use the
wrappers, so use them.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Juan Quintela <quintela@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org
---
hw/pci/pci.c | 3 +--
hw/usb/hcd-ehci-pci.c | 2 +-
migration/savevm.c | 3 +--
monitor/misc.c | 3 +--
softmmu/qdev-monitor.c | 3 +--
5 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 23d2ae2ab23..9af32ef4cb8 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1915,8 +1915,7 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
list = object_class_get_list_sorted(TYPE_PCI_DEVICE, false);
pci_nic_models = g_ptr_array_new();
while (list) {
- DeviceClass *dc = OBJECT_CLASS_CHECK(DeviceClass, list->data,
- TYPE_DEVICE);
+ DeviceClass *dc = DEVICE_CLASS(list->data);
GSList *next;
if (test_bit(DEVICE_CATEGORY_NETWORK, dc->categories) &&
dc->user_creatable) {
diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c
index 4c37c8e2271..345444a5739 100644
--- a/hw/usb/hcd-ehci-pci.c
+++ b/hw/usb/hcd-ehci-pci.c
@@ -74,7 +74,7 @@ static void usb_ehci_pci_realize(PCIDevice *dev, Error **errp)
static void usb_ehci_pci_init(Object *obj)
{
- DeviceClass *dc = OBJECT_GET_CLASS(DeviceClass, obj, TYPE_DEVICE);
+ DeviceClass *dc = DEVICE_GET_CLASS(obj);
EHCIPCIState *i = PCI_EHCI(obj);
EHCIState *s = &i->ehci;
diff --git a/migration/savevm.c b/migration/savevm.c
index 7b7b64bd13e..23cc55b8533 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -663,8 +663,7 @@ void dump_vmstate_json_to_file(FILE *out_file)
first = true;
list = object_class_get_list(TYPE_DEVICE, true);
for (elt = list; elt; elt = elt->next) {
- DeviceClass *dc = OBJECT_CLASS_CHECK(DeviceClass, elt->data,
- TYPE_DEVICE);
+ DeviceClass *dc = DEVICE_CLASS(elt->data);
const char *name;
int indent = 2;
diff --git a/monitor/misc.c b/monitor/misc.c
index ffe79668706..98202d12e7f 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -1549,8 +1549,7 @@ void device_add_completion(ReadLineState *rs, int nb_args, const char *str)
list = elt = object_class_get_list(TYPE_DEVICE, false);
while (elt) {
const char *name;
- DeviceClass *dc = OBJECT_CLASS_CHECK(DeviceClass, elt->data,
- TYPE_DEVICE);
+ DeviceClass *dc = DEVICE_CLASS(elt->data);
name = object_class_get_name(OBJECT_CLASS(dc));
if (dc->user_creatable
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index 721dec2d820..82d164c6539 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -165,8 +165,7 @@ static void qdev_print_devinfos(bool show_no_user)
for (i = 0; i <= DEVICE_CATEGORY_MAX; i++) {
cat_printed = false;
for (elt = list; elt; elt = elt->next) {
- DeviceClass *dc = OBJECT_CLASS_CHECK(DeviceClass, elt->data,
- TYPE_DEVICE);
+ DeviceClass *dc = DEVICE_CLASS(elt->data);
if ((i < DEVICE_CATEGORY_MAX
? !test_bit(i, dc->categories)
: !bitmap_empty(dc->categories, DEVICE_CATEGORY_MAX))
--
2.31.1
next prev parent reply other threads:[~2021-08-06 21:13 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 21:11 [PATCH for-6.2 00/12] qom: Get rid of all manual usage of OBJECT_CHECK & friends Eduardo Habkost
2021-08-06 21:11 ` [PATCH for-6.2 01/12] accel: Rename TYPE_ACCEL to TYPE_ACCEL_BASE Eduardo Habkost
2021-08-06 21:11 ` Eduardo Habkost [this message]
2021-08-07 8:17 ` [PATCH for-6.2 02/12] qom: Use DEVICE_*CLASS instead of OBJECT_*CLASS Philippe Mathieu-Daudé
2021-08-10 11:56 ` Juan Quintela
2021-08-10 14:22 ` Eduardo Habkost
2021-08-06 21:11 ` [PATCH for-6.2 03/12] scripts/codeconverter: Update to latest version Eduardo Habkost
2021-08-06 21:11 ` [PATCH for-6.2 04/12] [automated] Add struct names to typedefs used by QOM types Eduardo Habkost
2021-08-07 8:03 ` Philippe Mathieu-Daudé
2021-08-06 21:11 ` [PATCH for-6.2 05/12] [automated] Move QOM typedefs and add missing includes Eduardo Habkost
2021-08-07 8:13 ` Philippe Mathieu-Daudé
2021-08-10 6:06 ` Cornelia Huck
2021-08-10 12:01 ` Juan Quintela
2021-08-10 13:06 ` Eduardo Habkost
2021-08-06 21:11 ` [PATCH for-6.2 06/12] [automated] Split QOM "typedef struct T { ... } T" declarations Eduardo Habkost
2021-08-10 6:08 ` Cornelia Huck
2021-08-06 21:11 ` [PATCH for-6.2 07/12] [automated] Use DECLARE_*CHECKER* macros when possible Eduardo Habkost
2021-08-10 6:09 ` Cornelia Huck
2021-08-06 21:11 ` [PATCH for-6.2 08/12] npcm7xx_clk: Use DECLARE_INSTANCE_CHECKER Eduardo Habkost
2021-08-07 7:59 ` Philippe Mathieu-Daudé
2021-08-06 21:11 ` [PATCH for-6.2 09/12] npcm7xx_otp: Use DECLARE_CLASS_CHECKERS Eduardo Habkost
2021-08-07 8:00 ` Philippe Mathieu-Daudé
2021-08-06 21:11 ` [PATCH for-6.2 10/12] [automated] Use DECLARE_OBJ_CHECKERS when possible Eduardo Habkost
2021-08-06 21:11 ` [PATCH for-6.2 11/12] [automated] Use OBJECT_DECLARE_TYPE " Eduardo Habkost
2021-08-07 8:02 ` Philippe Mathieu-Daudé
2021-08-06 21:11 ` [PATCH for-6.2 12/12] [automated] Use OBJECT_DECLARE_SIMPLE_TYPE " Eduardo Habkost
2021-08-07 8:09 ` Philippe Mathieu-Daudé
2021-08-10 6:12 ` Cornelia Huck
2021-08-07 8:15 ` [PATCH for-6.2 00/12] qom: Get rid of all manual usage of OBJECT_CHECK & friends Philippe Mathieu-Daudé
2021-08-09 18:00 ` Eduardo Habkost
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=20210806211127.646908-3-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=kraxel@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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).