aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2023-02-20 11:42:46 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2023-02-27 22:29:02 +0100
commitce6ffeaed0872fb7a5e0f0ce164f5493956fb0f3 (patch)
treeb434bdec9ff806214d6adf83c4322fce43a38380 /hw
parentef177ee12281b4bdfc5950bbaa8b3a6ff71331cc (diff)
downloadqemu-ce6ffeaed0872fb7a5e0f0ce164f5493956fb0f3.zip
qemu-ce6ffeaed0872fb7a5e0f0ce164f5493956fb0f3.tar.gz
qemu-ce6ffeaed0872fb7a5e0f0ce164f5493956fb0f3.tar.bz2
hw/usb/uhci: Replace container_of() by UHCI_GET_CLASS() QOM macro
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> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230220150515.32549-6-philmd@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/usb/hcd-uhci.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index f77ffda..8ac1175 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;