[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 15/26] hw/usb: Add new 'usb-quirks.h' local header



On Sat, Jul 4, 2020 at 7:56 AM Philippe Mathieu-Daudé <f4bug@xxxxxxxxx> wrote:
>
> Only redirect.c consumes the quirks API. Reduce the big "hw/usb.h"
> header by moving the quirks related declaration into their own
> header. As nothing out of hw/usb/ requires it, keep it local.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>

Reviewed-by: Alistair Francis <alistair.francis@xxxxxxx>

Alistair

> ---
>  hw/usb/usb-quirks.h | 27 +++++++++++++++++++++++++++
>  include/hw/usb.h    | 11 -----------
>  hw/usb/quirks.c     |  1 +
>  hw/usb/redirect.c   |  1 +
>  4 files changed, 29 insertions(+), 11 deletions(-)
>  create mode 100644 hw/usb/usb-quirks.h
>
> diff --git a/hw/usb/usb-quirks.h b/hw/usb/usb-quirks.h
> new file mode 100644
> index 0000000000..542889efc4
> --- /dev/null
> +++ b/hw/usb/usb-quirks.h
> @@ -0,0 +1,27 @@
> +/*
> + * USB quirk handling
> + *
> + * Copyright (c) 2012 Red Hat, Inc.
> + *
> + * Red Hat Authors:
> + * Hans de Goede <hdegoede@xxxxxxxxxx>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#ifndef HW_USB_QUIRKS_H
> +#define HW_USB_QUIRKS_H
> +
> +/* In bulk endpoints are streaming data sources (iow behave like isoc eps) */
> +#define USB_QUIRK_BUFFER_BULK_IN        0x01
> +/* Bulk pkts in FTDI format, need special handling when combining packets */
> +#define USB_QUIRK_IS_FTDI               0x02
> +
> +int usb_get_quirks(uint16_t vendor_id, uint16_t product_id,
> +                   uint8_t interface_class, uint8_t interface_subclass,
> +                   uint8_t interface_protocol);
> +
> +#endif
> diff --git a/include/hw/usb.h b/include/hw/usb.h
> index 18f1349bdc..8c3bc920ff 100644
> --- a/include/hw/usb.h
> +++ b/include/hw/usb.h
> @@ -549,15 +549,4 @@ 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);
>
> -/* quirks.c */
> -
> -/* In bulk endpoints are streaming data sources (iow behave like isoc eps) */
> -#define USB_QUIRK_BUFFER_BULK_IN       0x01
> -/* Bulk pkts in FTDI format, need special handling when combining packets */
> -#define USB_QUIRK_IS_FTDI              0x02
> -
> -int usb_get_quirks(uint16_t vendor_id, uint16_t product_id,
> -                   uint8_t interface_class, uint8_t interface_subclass,
> -                   uint8_t interface_protocol);
> -
>  #endif
> diff --git a/hw/usb/quirks.c b/hw/usb/quirks.c
> index 655b36f2d5..b0d0f87e35 100644
> --- a/hw/usb/quirks.c
> +++ b/hw/usb/quirks.c
> @@ -15,6 +15,7 @@
>  #include "qemu/osdep.h"
>  #include "quirks.inc.c"
>  #include "hw/usb.h"
> +#include "usb-quirks.h"
>
>  static bool usb_id_match(const struct usb_device_id *ids,
>                           uint16_t vendor_id, uint16_t product_id,
> diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
> index 417a60a2e6..4c5925a039 100644
> --- a/hw/usb/redirect.c
> +++ b/hw/usb/redirect.c
> @@ -45,6 +45,7 @@
>  #include "hw/usb.h"
>  #include "migration/qemu-file-types.h"
>  #include "migration/vmstate.h"
> +#include "usb-quirks.h"
>
>  /* ERROR is defined below. Remove any previous definition. */
>  #undef ERROR
> --
> 2.21.3
>
>



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.