[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/9] hw/usb/hcd-uhci: Replace container_of() by UHCI_GET_CLASS()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 5/9] hw/usb/hcd-uhci: Replace container_of() by UHCI_GET_CLASS() QOM macro |
Date: |
Mon, 20 Feb 2023 16:05:11 +0100 |
By using the QOM UHCI_GET_CLASS() cast macro we don't to
use the intermediate PCIDeviceClass variable.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/usb/hcd-uhci.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index f77ffda69a..8ac1175ad2 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -1159,8 +1159,7 @@ static USBBusOps uhci_bus_ops = {
void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
{
Error *err = NULL;
- PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
- UHCIPCIDeviceClass *u = container_of(pc, UHCIPCIDeviceClass, parent_class);
+ UHCIPCIDeviceClass *u = UHCI_GET_CLASS(dev);
UHCIState *s = UHCI(dev);
uint8_t *pci_conf = s->dev.config;
int i;
@@ -1267,7 +1266,7 @@ void uhci_data_class_init(ObjectClass *klass, void *data)
{
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
DeviceClass *dc = DEVICE_CLASS(klass);
- UHCIPCIDeviceClass *u = container_of(k, UHCIPCIDeviceClass, parent_class);
+ UHCIPCIDeviceClass *u = UHCI_CLASS(klass);
UHCIInfo *info = data;
k->realize = info->realize ? info->realize : usb_uhci_common_realize;
--
2.38.1
- [PATCH 0/9] hw/usb: Cleanups around QOM style, Philippe Mathieu-Daudé, 2023/02/20
- [PATCH 1/9] hw/usb/dev-smartcard-reader: Avoid forward-declaring CCIDBus, Philippe Mathieu-Daudé, 2023/02/20
- [PATCH 2/9] hw/usb/hcd-ohci: Use OHCIState type definition, Philippe Mathieu-Daudé, 2023/02/20
- [PATCH 3/9] hw/usb/hcd-ohci-pci: Use QOM type-safe cast conversion macro, Philippe Mathieu-Daudé, 2023/02/20
- [PATCH 4/9] hw/usb/hcd-uhci: Declare QOM macros using OBJECT_DECLARE_TYPE(), Philippe Mathieu-Daudé, 2023/02/20
- [PATCH 5/9] hw/usb/hcd-uhci: Replace container_of() by UHCI_GET_CLASS() QOM macro,
Philippe Mathieu-Daudé <=
- [PATCH 6/9] hw/usb/hcd-xhci-nec: Declare QOM macros for NEC_XHCI, Philippe Mathieu-Daudé, 2023/02/20
- [PATCH 7/9] hw/usb/hcd-xhci-nec: Replace container_of() by NEC_XHCI() QOM cast macro, Philippe Mathieu-Daudé, 2023/02/20
- [PATCH 8/9] hw/usb/u2f: Declare QOM macros using OBJECT_DECLARE_TYPE(), Philippe Mathieu-Daudé, 2023/02/20
- [PATCH 9/9] hw/usb/u2f-passthru: Use QOM type-safe cast conversion macros, Philippe Mathieu-Daudé, 2023/02/20