Message ID | 20200704144943.18292-26-f4bug@amsat.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | hw/usb: Give it love, reduce 'hw/usb.h' inclusion out of hw/usb/ | expand |
On Sat, 4 Jul 2020, Philippe Mathieu-Daudé wrote: > Various machine/board/soc models create XHCI device instances > with the generic QDEV API, and don't need to access USB internals. > > Simplify header inclusions by moving the QOM type names into a > simple header, with no need to include other "hw/usb" headers. > > Suggested-by: BALATON Zoltan <balaton@eik.bme.hu> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > --- > hw/usb/hcd-xhci.h | 2 +- > include/hw/usb/usb-hcd.h | 3 +++ > hw/ppc/spapr.c | 2 +- > 3 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/hw/usb/hcd-xhci.h b/hw/usb/hcd-xhci.h > index f9a3aaceec..b6c54e38a6 100644 > --- a/hw/usb/hcd-xhci.h > +++ b/hw/usb/hcd-xhci.h > @@ -23,9 +23,9 @@ > #define HW_USB_HCD_XHCI_H > > #include "usb-internal.h" > +#include "hw/usb/usb-hcd.h" > > #define TYPE_XHCI "base-xhci" > -#define TYPE_NEC_XHCI "nec-usb-xhci" > #define TYPE_QEMU_XHCI "qemu-xhci" Why is qemu-xhci left here? Should that be moved to public header too? (Maybe no machine adds it but that's a public type too I think.) Regards. BALATON Zoltan > #define XHCI(obj) \ > diff --git a/include/hw/usb/usb-hcd.h b/include/hw/usb/usb-hcd.h > index c9d0a88984..56107fca62 100644 > --- a/include/hw/usb/usb-hcd.h > +++ b/include/hw/usb/usb-hcd.h > @@ -30,4 +30,7 @@ > #define TYPE_VT82C686B_USB_UHCI "vt82c686b-usb-uhci" > #define TYPE_ICH9_USB_UHCI(n) "ich9-usb-uhci" #n > > +/* XHCI */ > +#define TYPE_NEC_XHCI "nec-usb-xhci" > + > #endif > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index db1706a66c..d8b3978f24 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -2961,7 +2961,7 @@ static void spapr_machine_init(MachineState *machine) > if (smc->use_ohci_by_default) { > pci_create_simple(phb->bus, -1, TYPE_PCI_OHCI); > } else { > - pci_create_simple(phb->bus, -1, "nec-usb-xhci"); > + pci_create_simple(phb->bus, -1, TYPE_NEC_XHCI); > } > > if (spapr->has_graphics) { >
On 7/4/20 7:19 PM, BALATON Zoltan wrote: > On Sat, 4 Jul 2020, Philippe Mathieu-Daudé wrote: >> Various machine/board/soc models create XHCI device instances >> with the generic QDEV API, and don't need to access USB internals. >> >> Simplify header inclusions by moving the QOM type names into a >> simple header, with no need to include other "hw/usb" headers. >> >> Suggested-by: BALATON Zoltan <balaton@eik.bme.hu> >> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> >> --- >> hw/usb/hcd-xhci.h | 2 +- >> include/hw/usb/usb-hcd.h | 3 +++ >> hw/ppc/spapr.c | 2 +- >> 3 files changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/hw/usb/hcd-xhci.h b/hw/usb/hcd-xhci.h >> index f9a3aaceec..b6c54e38a6 100644 >> --- a/hw/usb/hcd-xhci.h >> +++ b/hw/usb/hcd-xhci.h >> @@ -23,9 +23,9 @@ >> #define HW_USB_HCD_XHCI_H >> >> #include "usb-internal.h" >> +#include "hw/usb/usb-hcd.h" >> >> #define TYPE_XHCI "base-xhci" >> -#define TYPE_NEC_XHCI "nec-usb-xhci" >> #define TYPE_QEMU_XHCI "qemu-xhci" > > Why is qemu-xhci left here? Should that be moved to public header too? > (Maybe no machine adds it but that's a public type too I think.) I don't know because I never used it, but I guess you are right. > > Regards. > BALATON Zoltan > >> #define XHCI(obj) \ >> diff --git a/include/hw/usb/usb-hcd.h b/include/hw/usb/usb-hcd.h >> index c9d0a88984..56107fca62 100644 >> --- a/include/hw/usb/usb-hcd.h >> +++ b/include/hw/usb/usb-hcd.h >> @@ -30,4 +30,7 @@ >> #define TYPE_VT82C686B_USB_UHCI "vt82c686b-usb-uhci" >> #define TYPE_ICH9_USB_UHCI(n) "ich9-usb-uhci" #n >> >> +/* XHCI */ >> +#define TYPE_NEC_XHCI "nec-usb-xhci" >> + >> #endif >> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c >> index db1706a66c..d8b3978f24 100644 >> --- a/hw/ppc/spapr.c >> +++ b/hw/ppc/spapr.c >> @@ -2961,7 +2961,7 @@ static void spapr_machine_init(MachineState >> *machine) >> if (smc->use_ohci_by_default) { >> pci_create_simple(phb->bus, -1, TYPE_PCI_OHCI); >> } else { >> - pci_create_simple(phb->bus, -1, "nec-usb-xhci"); >> + pci_create_simple(phb->bus, -1, TYPE_NEC_XHCI); >> } >> >> if (spapr->has_graphics) { >>
diff --git a/hw/usb/hcd-xhci.h b/hw/usb/hcd-xhci.h index f9a3aaceec..b6c54e38a6 100644 --- a/hw/usb/hcd-xhci.h +++ b/hw/usb/hcd-xhci.h @@ -23,9 +23,9 @@ #define HW_USB_HCD_XHCI_H #include "usb-internal.h" +#include "hw/usb/usb-hcd.h" #define TYPE_XHCI "base-xhci" -#define TYPE_NEC_XHCI "nec-usb-xhci" #define TYPE_QEMU_XHCI "qemu-xhci" #define XHCI(obj) \ diff --git a/include/hw/usb/usb-hcd.h b/include/hw/usb/usb-hcd.h index c9d0a88984..56107fca62 100644 --- a/include/hw/usb/usb-hcd.h +++ b/include/hw/usb/usb-hcd.h @@ -30,4 +30,7 @@ #define TYPE_VT82C686B_USB_UHCI "vt82c686b-usb-uhci" #define TYPE_ICH9_USB_UHCI(n) "ich9-usb-uhci" #n +/* XHCI */ +#define TYPE_NEC_XHCI "nec-usb-xhci" + #endif diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index db1706a66c..d8b3978f24 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2961,7 +2961,7 @@ static void spapr_machine_init(MachineState *machine) if (smc->use_ohci_by_default) { pci_create_simple(phb->bus, -1, TYPE_PCI_OHCI); } else { - pci_create_simple(phb->bus, -1, "nec-usb-xhci"); + pci_create_simple(phb->bus, -1, TYPE_NEC_XHCI); } if (spapr->has_graphics) {
Various machine/board/soc models create XHCI device instances with the generic QDEV API, and don't need to access USB internals. Simplify header inclusions by moving the QOM type names into a simple header, with no need to include other "hw/usb" headers. Suggested-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- hw/usb/hcd-xhci.h | 2 +- include/hw/usb/usb-hcd.h | 3 +++ hw/ppc/spapr.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-)