From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org, Eduardo Habkost <eduardo@habkost.net>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Edgar E . Iglesias" <edgar.iglesias@gmail.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Samuel Thibault" <samuel.thibault@ens-lyon.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Thomas Huth" <thuth@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [RFC PATCH 0/3] qdev: Introduce QDEV_DECLARE_DEV_BUS_TYPES() macro
Date: Mon, 13 Feb 2023 11:56:06 +0100 [thread overview]
Message-ID: <20230213105609.6173-1-philmd@linaro.org> (raw)
Experiment after discussing with Thomas around qdev_get_parent_bus:
https://lore.kernel.org/qemu-devel/ad356f64-dca0-8117-d22a-a530e620ddb0@redhat.com/
When a QDev plug on a QBus, we'll always use qdev_get_parent_bus()
at least once with this type. Why not provide a consistent defined
macro instead of:
1/ adding an inlined helper such usb_bus_from_device()
or scsi_bus_from_device() with different type checks,
2/ open-code calls to qdev_get_parent_bus() with unsafe casts
?
This RFC series introduce a QDev-equivalent of QOM DECLARE_TYPES
macro, to be used with a (device, bus) tuple, and declaring the
equivalent device_GET_BUS() macro.
hw/usb/ is converted as an example.
Philippe Mathieu-Daudé (3):
hw/qdev: Introduce QDEV_DECLARE_DEV_BUS_TYPES() macro
hw/usb: Declare QOM macros using QDEV_DECLARE_DEV_BUS_TYPES()
hw/usb: Use USB_DEVICE_GET_BUS() macro
hw/usb/bus.c | 10 +++++-----
hw/usb/core.c | 6 +++---
hw/usb/dev-hub.c | 4 ++--
hw/usb/dev-serial.c | 10 +++++-----
hw/usb/hcd-xhci.c | 2 +-
include/hw/qdev-core.h | 28 ++++++++++++++++++++++++++++
include/hw/usb.h | 13 ++++---------
7 files changed, 48 insertions(+), 25 deletions(-)
--
2.38.1
next reply other threads:[~2023-02-13 10:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-13 10:56 Philippe Mathieu-Daudé [this message]
2023-02-13 10:56 ` [RFC PATCH 1/3] hw/qdev: Introduce QDEV_DECLARE_DEV_BUS_TYPES() macro Philippe Mathieu-Daudé
2023-03-01 14:59 ` Daniel P. Berrangé
2023-02-13 10:56 ` [RFC PATCH 2/3] hw/usb: Declare QOM macros using QDEV_DECLARE_DEV_BUS_TYPES() Philippe Mathieu-Daudé
2023-02-13 10:56 ` [RFC PATCH 3/3] hw/usb: Use USB_DEVICE_GET_BUS() macro Philippe Mathieu-Daudé
2023-03-01 14:42 ` [RFC PATCH 0/3] qdev: Introduce QDEV_DECLARE_DEV_BUS_TYPES() macro Igor Mammedov
2023-03-01 15:02 ` Daniel P. Berrangé
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=20230213105609.6173-1-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=edgar.iglesias@gmail.com \
--cc=eduardo@habkost.net \
--cc=imammedo@redhat.com \
--cc=kraxel@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=samuel.thibault@ens-lyon.org \
--cc=thuth@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).