On 13/02/2023 08.08, Philippe Mathieu-Daudé wrote:
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
RFC Other devices don't use such helper. Maybe it should
be the other way around, introduce more bus_from_device()
helpers?
---
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/usb.h | 5 -----
6 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index d7c3c71435..4a1b67761c 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -427,7 +427,7 @@ void usb_unregister_port(USBBus *bus, USBPort *port)
void usb_claim_port(USBDevice *dev, Error **errp)
{
- USBBus *bus = usb_bus_from_device(dev);
+ USBBus *bus = USB_BUS(qdev_get_parent_bus(DEVICE(dev)));
You're certainly missing a proper justification in the patch description
here. The "other devices don't use such a helper" does not sound like a real
justification to me, since the code lines rather get longer this way. Thus
this rather looks like unnecessary code churn to me --> rather drop the patch?
Thomas