Message ID | 20200704144943.18292-14-f4bug@amsat.org |
---|---|
State | New |
Headers | show |
Series | hw/usb: Give it love, reduce 'hw/usb.h' inclusion out of hw/usb/ | expand |
On Sat, Jul 4, 2020 at 7:59 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: > > USBDescString is forward-declared. Only bus.c uses the > usb_device_get_product_desc() and usb_device_get_usb_desc() > function. Move all that to the "desc.h" header to reduce > the big "hw/usb.h" header a bit. > > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Alistair > --- > hw/usb/desc.h | 10 ++++++++++ > include/hw/usb.h | 10 ---------- > hw/usb/bus.c | 1 + > 3 files changed, 11 insertions(+), 10 deletions(-) > > diff --git a/hw/usb/desc.h b/hw/usb/desc.h > index 92594fbe29..4bf6966c4b 100644 > --- a/hw/usb/desc.h > +++ b/hw/usb/desc.h > @@ -242,4 +242,14 @@ int usb_desc_get_descriptor(USBDevice *dev, USBPacket *p, > int usb_desc_handle_control(USBDevice *dev, USBPacket *p, > int request, int value, int index, int length, uint8_t *data); > > +const char *usb_device_get_product_desc(USBDevice *dev); > + > +const USBDesc *usb_device_get_usb_desc(USBDevice *dev); > + > +struct USBDescString { > + uint8_t index; > + char *str; > + QLIST_ENTRY(USBDescString) next; > +}; > + > #endif /* QEMU_HW_USB_DESC_H */ > diff --git a/include/hw/usb.h b/include/hw/usb.h > index 15b2ef300a..18f1349bdc 100644 > --- a/include/hw/usb.h > +++ b/include/hw/usb.h > @@ -192,12 +192,6 @@ typedef struct USBDescOther USBDescOther; > typedef struct USBDescString USBDescString; > typedef struct USBDescMSOS USBDescMSOS; > > -struct USBDescString { > - uint8_t index; > - char *str; > - QLIST_ENTRY(USBDescString) next; > -}; > - > #define USB_MAX_ENDPOINTS 15 > #define USB_MAX_INTERFACES 16 > > @@ -555,10 +549,6 @@ int usb_device_alloc_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps, > int streams); > void usb_device_free_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps); > > -const char *usb_device_get_product_desc(USBDevice *dev); > - > -const USBDesc *usb_device_get_usb_desc(USBDevice *dev); > - > /* quirks.c */ > > /* In bulk endpoints are streaming data sources (iow behave like isoc eps) */ > diff --git a/hw/usb/bus.c b/hw/usb/bus.c > index 957559b18d..111c3af7c1 100644 > --- a/hw/usb/bus.c > +++ b/hw/usb/bus.c > @@ -9,6 +9,7 @@ > #include "monitor/monitor.h" > #include "trace.h" > #include "qemu/cutils.h" > +#include "desc.h" > > static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent); > > -- > 2.21.3 > >
diff --git a/hw/usb/desc.h b/hw/usb/desc.h index 92594fbe29..4bf6966c4b 100644 --- a/hw/usb/desc.h +++ b/hw/usb/desc.h @@ -242,4 +242,14 @@ int usb_desc_get_descriptor(USBDevice *dev, USBPacket *p, int usb_desc_handle_control(USBDevice *dev, USBPacket *p, int request, int value, int index, int length, uint8_t *data); +const char *usb_device_get_product_desc(USBDevice *dev); + +const USBDesc *usb_device_get_usb_desc(USBDevice *dev); + +struct USBDescString { + uint8_t index; + char *str; + QLIST_ENTRY(USBDescString) next; +}; + #endif /* QEMU_HW_USB_DESC_H */ diff --git a/include/hw/usb.h b/include/hw/usb.h index 15b2ef300a..18f1349bdc 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -192,12 +192,6 @@ typedef struct USBDescOther USBDescOther; typedef struct USBDescString USBDescString; typedef struct USBDescMSOS USBDescMSOS; -struct USBDescString { - uint8_t index; - char *str; - QLIST_ENTRY(USBDescString) next; -}; - #define USB_MAX_ENDPOINTS 15 #define USB_MAX_INTERFACES 16 @@ -555,10 +549,6 @@ int usb_device_alloc_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps, int streams); void usb_device_free_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps); -const char *usb_device_get_product_desc(USBDevice *dev); - -const USBDesc *usb_device_get_usb_desc(USBDevice *dev); - /* quirks.c */ /* In bulk endpoints are streaming data sources (iow behave like isoc eps) */ diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 957559b18d..111c3af7c1 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -9,6 +9,7 @@ #include "monitor/monitor.h" #include "trace.h" #include "qemu/cutils.h" +#include "desc.h" static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent);
USBDescString is forward-declared. Only bus.c uses the usb_device_get_product_desc() and usb_device_get_usb_desc() function. Move all that to the "desc.h" header to reduce the big "hw/usb.h" header a bit. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- hw/usb/desc.h | 10 ++++++++++ include/hw/usb.h | 10 ---------- hw/usb/bus.c | 1 + 3 files changed, 11 insertions(+), 10 deletions(-)