* [PATCH 1/4] hw/core/cpu: Simplify realize() using MACHINE_GET_CLASS() macro
2023-05-23 6:12 [PATCH 0/4] hw: Minor simplifications using proper QOM getter macros Philippe Mathieu-Daudé
@ 2023-05-23 6:12 ` Philippe Mathieu-Daudé
2023-05-23 18:22 ` Richard Henderson
2023-05-23 6:12 ` [PATCH 2/4] hw/i386/microvm: Simplify using object_dynamic_cast() Philippe Mathieu-Daudé
` (3 subsequent siblings)
4 siblings, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-05-23 6:12 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Sergio Lopez, Michael S. Tsirkin, Eduardo Habkost,
qemu-trivial, Richard Henderson, Gerd Hoffmann, Marcel Apfelbaum,
Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/core/cpu-common.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index 5ccc3837b6..620312e9a5 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -196,8 +196,7 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp)
* no need to check the ignore_memory_transaction_failures board flag.
*/
if (object_dynamic_cast(machine, TYPE_MACHINE)) {
- ObjectClass *oc = object_get_class(machine);
- MachineClass *mc = MACHINE_CLASS(oc);
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
if (mc) {
cpu->ignore_memory_transaction_failures =
--
2.38.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/4] hw/core/cpu: Simplify realize() using MACHINE_GET_CLASS() macro
2023-05-23 6:12 ` [PATCH 1/4] hw/core/cpu: Simplify realize() using MACHINE_GET_CLASS() macro Philippe Mathieu-Daudé
@ 2023-05-23 18:22 ` Richard Henderson
0 siblings, 0 replies; 13+ messages in thread
From: Richard Henderson @ 2023-05-23 18:22 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Sergio Lopez, Michael S. Tsirkin, Eduardo Habkost,
qemu-trivial, Gerd Hoffmann, Marcel Apfelbaum
On 5/22/23 23:12, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> hw/core/cpu-common.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/4] hw/i386/microvm: Simplify using object_dynamic_cast()
2023-05-23 6:12 [PATCH 0/4] hw: Minor simplifications using proper QOM getter macros Philippe Mathieu-Daudé
2023-05-23 6:12 ` [PATCH 1/4] hw/core/cpu: Simplify realize() using MACHINE_GET_CLASS() macro Philippe Mathieu-Daudé
@ 2023-05-23 6:12 ` Philippe Mathieu-Daudé
2023-05-23 18:22 ` Richard Henderson
2023-05-26 8:35 ` Sergio Lopez
2023-05-23 6:12 ` [PATCH 3/4] hw/pci/pci: Simplify pci_bar_address() using MACHINE_GET_CLASS() macro Philippe Mathieu-Daudé
` (2 subsequent siblings)
4 siblings, 2 replies; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-05-23 6:12 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Sergio Lopez, Michael S. Tsirkin, Eduardo Habkost,
qemu-trivial, Richard Henderson, Gerd Hoffmann, Marcel Apfelbaum,
Philippe Mathieu-Daudé
Use object_dynamic_cast() to determine if 'dev' is a TYPE_VIRTIO_MMIO.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/microvm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 3d606a20b4..7227a2156c 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -389,9 +389,8 @@ static void microvm_fix_kernel_cmdline(MachineState *machine)
bus = sysbus_get_default();
QTAILQ_FOREACH(kid, &bus->children, sibling) {
DeviceState *dev = kid->child;
- ObjectClass *class = object_get_class(OBJECT(dev));
- if (class == object_class_by_name(TYPE_VIRTIO_MMIO)) {
+ if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MMIO)) {
VirtIOMMIOProxy *mmio = VIRTIO_MMIO(OBJECT(dev));
VirtioBusState *mmio_virtio_bus = &mmio->bus;
BusState *mmio_bus = &mmio_virtio_bus->parent_obj;
--
2.38.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 2/4] hw/i386/microvm: Simplify using object_dynamic_cast()
2023-05-23 6:12 ` [PATCH 2/4] hw/i386/microvm: Simplify using object_dynamic_cast() Philippe Mathieu-Daudé
@ 2023-05-23 18:22 ` Richard Henderson
2023-05-26 8:35 ` Sergio Lopez
1 sibling, 0 replies; 13+ messages in thread
From: Richard Henderson @ 2023-05-23 18:22 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Sergio Lopez, Michael S. Tsirkin, Eduardo Habkost,
qemu-trivial, Gerd Hoffmann, Marcel Apfelbaum
On 5/22/23 23:12, Philippe Mathieu-Daudé wrote:
> Use object_dynamic_cast() to determine if 'dev' is a TYPE_VIRTIO_MMIO.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> hw/i386/microvm.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/4] hw/i386/microvm: Simplify using object_dynamic_cast()
2023-05-23 6:12 ` [PATCH 2/4] hw/i386/microvm: Simplify using object_dynamic_cast() Philippe Mathieu-Daudé
2023-05-23 18:22 ` Richard Henderson
@ 2023-05-26 8:35 ` Sergio Lopez
1 sibling, 0 replies; 13+ messages in thread
From: Sergio Lopez @ 2023-05-26 8:35 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Paolo Bonzini, Michael S. Tsirkin, Eduardo Habkost,
qemu-trivial, Richard Henderson, Gerd Hoffmann, Marcel Apfelbaum
[-- Attachment #1: Type: text/plain, Size: 346 bytes --]
On Tue, May 23, 2023 at 08:12:05AM +0200, Philippe Mathieu-Daudé wrote:
> Use object_dynamic_cast() to determine if 'dev' is a TYPE_VIRTIO_MMIO.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/i386/microvm.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Reviewed-by: Sergio Lopez <slp@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/4] hw/pci/pci: Simplify pci_bar_address() using MACHINE_GET_CLASS() macro
2023-05-23 6:12 [PATCH 0/4] hw: Minor simplifications using proper QOM getter macros Philippe Mathieu-Daudé
2023-05-23 6:12 ` [PATCH 1/4] hw/core/cpu: Simplify realize() using MACHINE_GET_CLASS() macro Philippe Mathieu-Daudé
2023-05-23 6:12 ` [PATCH 2/4] hw/i386/microvm: Simplify using object_dynamic_cast() Philippe Mathieu-Daudé
@ 2023-05-23 6:12 ` Philippe Mathieu-Daudé
2023-05-23 18:23 ` Richard Henderson
2023-05-23 6:12 ` [PATCH 4/4] hw/usb/hcd-ehci-pci: Simplify using DEVICE_GET_CLASS() macro Philippe Mathieu-Daudé
2023-06-08 18:41 ` [PATCH 0/4] hw: Minor simplifications using proper QOM getter macros Michael Tokarev
4 siblings, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-05-23 6:12 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Sergio Lopez, Michael S. Tsirkin, Eduardo Habkost,
qemu-trivial, Richard Henderson, Gerd Hoffmann, Marcel Apfelbaum,
Philippe Mathieu-Daudé
Remove unnecessary intermediate variables.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/pci/pci.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 1cc7c89036..a2cb6071cb 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1444,9 +1444,7 @@ pcibus_t pci_bar_address(PCIDevice *d,
{
pcibus_t new_addr, last_addr;
uint16_t cmd = pci_get_word(d->config + PCI_COMMAND);
- Object *machine = qdev_get_machine();
- ObjectClass *oc = object_get_class(machine);
- MachineClass *mc = MACHINE_CLASS(oc);
+ MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
bool allow_0_address = mc->pci_allow_0_address;
if (type & PCI_BASE_ADDRESS_SPACE_IO) {
--
2.38.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 3/4] hw/pci/pci: Simplify pci_bar_address() using MACHINE_GET_CLASS() macro
2023-05-23 6:12 ` [PATCH 3/4] hw/pci/pci: Simplify pci_bar_address() using MACHINE_GET_CLASS() macro Philippe Mathieu-Daudé
@ 2023-05-23 18:23 ` Richard Henderson
0 siblings, 0 replies; 13+ messages in thread
From: Richard Henderson @ 2023-05-23 18:23 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Sergio Lopez, Michael S. Tsirkin, Eduardo Habkost,
qemu-trivial, Gerd Hoffmann, Marcel Apfelbaum
On 5/22/23 23:12, Philippe Mathieu-Daudé wrote:
> Remove unnecessary intermediate variables.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> hw/pci/pci.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 4/4] hw/usb/hcd-ehci-pci: Simplify using DEVICE_GET_CLASS() macro
2023-05-23 6:12 [PATCH 0/4] hw: Minor simplifications using proper QOM getter macros Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2023-05-23 6:12 ` [PATCH 3/4] hw/pci/pci: Simplify pci_bar_address() using MACHINE_GET_CLASS() macro Philippe Mathieu-Daudé
@ 2023-05-23 6:12 ` Philippe Mathieu-Daudé
2023-05-23 18:24 ` Richard Henderson
2023-06-08 18:41 ` [PATCH 0/4] hw: Minor simplifications using proper QOM getter macros Michael Tokarev
4 siblings, 1 reply; 13+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-05-23 6:12 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Sergio Lopez, Michael S. Tsirkin, Eduardo Habkost,
qemu-trivial, Richard Henderson, Gerd Hoffmann, Marcel Apfelbaum,
Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/usb/hcd-ehci-pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c
index 4c37c8e227..345444a573 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;
--
2.38.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 4/4] hw/usb/hcd-ehci-pci: Simplify using DEVICE_GET_CLASS() macro
2023-05-23 6:12 ` [PATCH 4/4] hw/usb/hcd-ehci-pci: Simplify using DEVICE_GET_CLASS() macro Philippe Mathieu-Daudé
@ 2023-05-23 18:24 ` Richard Henderson
0 siblings, 0 replies; 13+ messages in thread
From: Richard Henderson @ 2023-05-23 18:24 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Sergio Lopez, Michael S. Tsirkin, Eduardo Habkost,
qemu-trivial, Gerd Hoffmann, Marcel Apfelbaum
On 5/22/23 23:12, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> hw/usb/hcd-ehci-pci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/4] hw: Minor simplifications using proper QOM getter macros
2023-05-23 6:12 [PATCH 0/4] hw: Minor simplifications using proper QOM getter macros Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2023-05-23 6:12 ` [PATCH 4/4] hw/usb/hcd-ehci-pci: Simplify using DEVICE_GET_CLASS() macro Philippe Mathieu-Daudé
@ 2023-06-08 18:41 ` Michael Tokarev
2023-06-22 20:33 ` Michael S. Tsirkin
4 siblings, 1 reply; 13+ messages in thread
From: Michael Tokarev @ 2023-06-08 18:41 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Sergio Lopez, Michael S. Tsirkin, Eduardo Habkost,
qemu-trivial, Richard Henderson, Gerd Hoffmann, Marcel Apfelbaum
23.05.2023 09:12, Philippe Mathieu-Daudé wrote:
> Enforce QOM style. Besides, using the proper QOM macros
> slightly simplifies the code.
Applied to my trivial-patches branch (Maybe it's time to resurrect it).
Thanks,
/mjt
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/4] hw: Minor simplifications using proper QOM getter macros
2023-06-08 18:41 ` [PATCH 0/4] hw: Minor simplifications using proper QOM getter macros Michael Tokarev
@ 2023-06-22 20:33 ` Michael S. Tsirkin
2023-06-23 7:00 ` Michael Tokarev
0 siblings, 1 reply; 13+ messages in thread
From: Michael S. Tsirkin @ 2023-06-22 20:33 UTC (permalink / raw)
To: Michael Tokarev
Cc: Philippe Mathieu-Daudé, qemu-devel, Paolo Bonzini,
Sergio Lopez, Eduardo Habkost, qemu-trivial, Richard Henderson,
Gerd Hoffmann, Marcel Apfelbaum
On Thu, Jun 08, 2023 at 09:41:58PM +0300, Michael Tokarev wrote:
> 23.05.2023 09:12, Philippe Mathieu-Daudé wrote:
> > Enforce QOM style. Besides, using the proper QOM macros
> > slightly simplifies the code.
>
> Applied to my trivial-patches branch (Maybe it's time to resurrect it).
>
> Thanks,
>
> /mjt
pci things:
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/4] hw: Minor simplifications using proper QOM getter macros
2023-06-22 20:33 ` Michael S. Tsirkin
@ 2023-06-23 7:00 ` Michael Tokarev
0 siblings, 0 replies; 13+ messages in thread
From: Michael Tokarev @ 2023-06-23 7:00 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Philippe Mathieu-Daudé, qemu-devel, Paolo Bonzini,
Sergio Lopez, Eduardo Habkost, qemu-trivial, Richard Henderson,
Gerd Hoffmann, Marcel Apfelbaum
22.06.2023 23:33, Michael S. Tsirkin wrote:
> On Thu, Jun 08, 2023 at 09:41:58PM +0300, Michael Tokarev wrote:
>> Applied to my trivial-patches branch (Maybe it's time to resurrect it).
> pci things:
>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
It's been merged to master on Jun-11 already. But thank you for the review anyway! :)
/mjt
^ permalink raw reply [flat|nested] 13+ messages in thread