[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
From: |
Alistair Francis |
Subject: |
Re: [PATCH 15/26] hw/usb: Add new 'usb-quirks.h' local header |
Date: |
Mon, 6 Jul 2020 10:45:21 -0700 |
On Sat, Jul 4, 2020 at 7:56 AM Philippe Mathieu-Daudé <f4bug@amsat.org> 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@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
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@redhat.com>
> + *
> + * 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
>
>
- Re: [PATCH 10/26] hw/usb/hcd-ehci: Move few definitions from header to source, (continued)
- [PATCH 11/26] hw/usb/hcd-xhci: Add missing header, Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 12/26] hw/usb/hcd-musb: Restrict header scope, Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 14/26] hw/usb/quirks: Rename included source with '.inc.c' suffix, Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 13/26] hw/usb/desc: Reduce some declarations scope, Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 15/26] hw/usb: Add new 'usb-quirks.h' local header, Philippe Mathieu-Daudé, 2020/07/04
- Re: [PATCH 15/26] hw/usb: Add new 'usb-quirks.h' local header,
Alistair Francis <=
- [PATCH 16/26] hw/usb/bus: Simplify usb_get_dev_path(), Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 17/26] hw/usb/bus: Rename usb_get_dev_path() as usb_get_full_dev_path(), Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 18/26] hw/usb/bus: Add usb_get_port_path(), Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 19/26] hw/ppc/spapr: Use usb_get_port_path(), Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 20/26] hw/usb: Introduce "hw/usb/usb.h" public API, Philippe Mathieu-Daudé, 2020/07/04
- [PATCH 21/26] hw/usb: Move internal API to local 'usb-internal.h' header, Philippe Mathieu-Daudé, 2020/07/04