[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/3] usb/hcd-xhci: Split pci wrapper for xhci base model
From: |
Gerd Hoffmann |
Subject: |
Re: [PATCH 3/3] usb/hcd-xhci: Split pci wrapper for xhci base model |
Date: |
Tue, 3 Mar 2020 11:27:37 +0100 |
> +typedef struct XHCIPciState {
> + /*< private >*/
> + PCIDevice parent_obj;
> + /*< public >*/
> + XHCIState *xhci;
Better embed the struct instead of storing a pointer.
> struct XHCIState {
> - /*< private >*/
> - PCIDevice parent_obj;
> - /*< public >*/
> -
> + DeviceState parent;
Why do you need this? XHCIState will not be used standalone, it will be
part of XHCIPciState or XHCISysbusState, which in turn has a DeviceState
already.
> + void (*intr_update)(void *opaque, int n, bool enable);
> + void (*intr_raise)(void *opaque, int n, bool level);
Use "struct XHCIState*" instead of "void*" please, then use container_of
to get XHCIPciState or XHCISysbusState.
cheers,
Gerd