qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Sergio Lopez" <slp@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	qemu-trivial@nongnu.org,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH 3/4] hw/pci/pci: Simplify pci_bar_address() using MACHINE_GET_CLASS() macro
Date: Tue, 23 May 2023 08:12:06 +0200	[thread overview]
Message-ID: <20230523061207.48818-4-philmd@linaro.org> (raw)
In-Reply-To: <20230523061207.48818-1-philmd@linaro.org>

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



  parent reply	other threads:[~2023-05-23  6:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 18:22   ` Richard Henderson
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
2023-05-23  6:12 ` Philippe Mathieu-Daudé [this message]
2023-05-23 18:23   ` [PATCH 3/4] hw/pci/pci: Simplify pci_bar_address() using MACHINE_GET_CLASS() macro 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-05-23 18:24   ` Richard Henderson
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

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=20230523061207.48818-4-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=eduardo@habkost.net \
    --cc=kraxel@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=slp@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).