From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gonglei <arei.gonglei@huawei.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 17/19] usb: usb-redir QOMify
Date: Fri, 8 May 2015 13:45:51 +0200 [thread overview]
Message-ID: <1431085553-6055-18-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1431085553-6055-1-git-send-email-kraxel@redhat.com>
From: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/redirect.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 2416de8..242a654 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -130,6 +130,9 @@ struct USBRedirDevice {
int compatible_speedmask;
};
+#define TYPE_USB_REDIR "usb-redir"
+#define USB_REDIRECT(obj) OBJECT_CHECK(USBRedirDevice, (obj), TYPE_USB_REDIR)
+
static void usbredir_hello(void *priv, struct usb_redir_hello_header *h);
static void usbredir_device_connect(void *priv,
struct usb_redir_device_connect_header *device_connect);
@@ -360,7 +363,7 @@ static void packet_id_queue_empty(struct PacketIdQueue *q)
static void usbredir_cancel_packet(USBDevice *udev, USBPacket *p)
{
- USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
+ USBRedirDevice *dev = USB_REDIRECT(udev);
int i = USBEP2I(p->ep);
if (p->combined) {
@@ -500,7 +503,7 @@ static void usbredir_free_bufpq(USBRedirDevice *dev, uint8_t ep)
static void usbredir_handle_reset(USBDevice *udev)
{
- USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
+ USBRedirDevice *dev = USB_REDIRECT(udev);
DPRINTF("reset device\n");
usbredirparser_send_reset(dev->parser);
@@ -907,7 +910,7 @@ static void usbredir_stop_interrupt_receiving(USBRedirDevice *dev,
static void usbredir_handle_data(USBDevice *udev, USBPacket *p)
{
- USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
+ USBRedirDevice *dev = USB_REDIRECT(udev);
uint8_t ep;
ep = p->ep->nr;
@@ -976,7 +979,7 @@ static void usbredir_stop_ep(USBRedirDevice *dev, int i)
static void usbredir_ep_stopped(USBDevice *udev, USBEndpoint *uep)
{
- USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
+ USBRedirDevice *dev = USB_REDIRECT(udev);
usbredir_stop_ep(dev, USBEP2I(uep));
usbredirparser_do_write(dev->parser);
@@ -1046,7 +1049,7 @@ static void usbredir_get_interface(USBRedirDevice *dev, USBPacket *p,
static void usbredir_handle_control(USBDevice *udev, USBPacket *p,
int request, int value, int index, int length, uint8_t *data)
{
- USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
+ USBRedirDevice *dev = USB_REDIRECT(udev);
struct usb_redir_control_packet_header control_packet;
if (usbredir_already_in_flight(dev, p->id)) {
@@ -1101,7 +1104,7 @@ static void usbredir_handle_control(USBDevice *udev, USBPacket *p,
static int usbredir_alloc_streams(USBDevice *udev, USBEndpoint **eps,
int nr_eps, int streams)
{
- USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
+ USBRedirDevice *dev = USB_REDIRECT(udev);
#if USBREDIR_VERSION >= 0x000700
struct usb_redir_alloc_bulk_streams_header alloc_streams;
int i;
@@ -1140,7 +1143,7 @@ static void usbredir_free_streams(USBDevice *udev, USBEndpoint **eps,
int nr_eps)
{
#if USBREDIR_VERSION >= 0x000700
- USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
+ USBRedirDevice *dev = USB_REDIRECT(udev);
struct usb_redir_free_bulk_streams_header free_streams;
int i;
@@ -1362,7 +1365,7 @@ static void usbredir_init_endpoints(USBRedirDevice *dev)
static void usbredir_realize(USBDevice *udev, Error **errp)
{
- USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
+ USBRedirDevice *dev = USB_REDIRECT(udev);
int i;
if (dev->cs == NULL) {
@@ -1415,7 +1418,7 @@ static void usbredir_cleanup_device_queues(USBRedirDevice *dev)
static void usbredir_handle_destroy(USBDevice *udev)
{
- USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
+ USBRedirDevice *dev = USB_REDIRECT(udev);
qemu_chr_delete(dev->cs);
dev->cs = NULL;
@@ -2496,7 +2499,7 @@ static void usbredir_class_initfn(ObjectClass *klass, void *data)
static void usbredir_instance_init(Object *obj)
{
USBDevice *udev = USB_DEVICE(obj);
- USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
+ USBRedirDevice *dev = USB_REDIRECT(udev);
device_add_bootindex_property(obj, &dev->bootindex,
"bootindex", NULL,
@@ -2504,7 +2507,7 @@ static void usbredir_instance_init(Object *obj)
}
static const TypeInfo usbredir_dev_info = {
- .name = "usb-redir",
+ .name = TYPE_USB_REDIR,
.parent = TYPE_USB_DEVICE,
.instance_size = sizeof(USBRedirDevice),
.class_init = usbredir_class_initfn,
--
1.8.3.1
next prev parent reply other threads:[~2015-05-08 11:46 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-08 11:45 [Qemu-devel] [PULL 00/19] usb: qomify, bugfixes for xhci & uhci Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 01/19] usb: fix usb-net segfault Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 02/19] xhci: set timer to retry xfers Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 03/19] Revert "xhci: generate a Transfer Event for each Transfer TRB with the IOC bit set" Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 04/19] xhci: fix events for setup trb Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 05/19] uhci: QOMify Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 06/19] usb: usb-audio QOMify Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 07/19] usb: usb-bt QOMify Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 08/19] usb: usb-hid QOMify Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 09/19] usb: usb-hub QOMify Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 10/19] usb: usb-mtp QOMify Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 11/19] usb-mtp: fix segmentation fault Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 12/19] usb: usb-net QOMify Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 13/19] usb: usb-ccid QOMify Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 14/19] usb: usb-storage QOMify Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 15/19] usb: usb-uas QOMify Gerd Hoffmann
2015-05-08 11:45 ` [Qemu-devel] [PULL 16/19] usb: usb-wacom-tablet QOMify Gerd Hoffmann
2015-05-08 11:45 ` Gerd Hoffmann [this message]
2015-05-08 11:45 ` [Qemu-devel] [PULL 18/19] usb: usb-serial QOMify Gerd Hoffmann
2015-05-10 22:18 ` Samuel Thibault
2015-05-08 11:45 ` [Qemu-devel] [PULL 19/19] uhci: controller is halted after reset Gerd Hoffmann
2015-05-11 9:42 ` [Qemu-devel] [PULL 00/19] usb: qomify, bugfixes for xhci & uhci Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431085553-6055-18-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).