From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpLIj-0007S6-Gz for qemu-devel@nongnu.org; Mon, 23 Jan 2012 09:55:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RpLIh-0004QM-O8 for qemu-devel@nongnu.org; Mon, 23 Jan 2012 09:55:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15559) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpLIh-0004Q4-Ev for qemu-devel@nongnu.org; Mon, 23 Jan 2012 09:55:15 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0NEtEPQ031507 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 23 Jan 2012 09:55:14 -0500 From: Gerd Hoffmann Date: Mon, 23 Jan 2012 15:54:47 +0100 Message-Id: <1327330511-16307-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1327330511-16307-1-git-send-email-kraxel@redhat.com> References: <1327330511-16307-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 01/25] usb: kill USB_MSG_{ATTACH,DETACH} List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann The USB subsystem pipes internal attach/detach notifications through usb_handle_packet() with a special magic PID. This indirection is a pretty pointless excercise as it ends up being handled by usb_generic_handle_packet anyway. Remove it. Signed-off-by: Gerd Hoffmann --- hw/usb.c | 18 +++++------------- hw/usb.h | 2 -- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/hw/usb.c b/hw/usb.c index 860538a..8242647 100644 --- a/hw/usb.c +++ b/hw/usb.c @@ -35,7 +35,10 @@ void usb_attach(USBPort *port) assert(dev->attached); assert(dev->state == USB_STATE_NOTATTACHED); port->ops->attach(port); - usb_send_msg(dev, USB_MSG_ATTACH); + dev->state = USB_STATE_ATTACHED; + if (dev->info->handle_attach) { + dev->info->handle_attach(dev); + } } void usb_detach(USBPort *port) @@ -45,7 +48,7 @@ void usb_detach(USBPort *port) assert(dev != NULL); assert(dev->state != USB_STATE_NOTATTACHED); port->ops->detach(port); - usb_send_msg(dev, USB_MSG_DETACH); + dev->state = USB_STATE_NOTATTACHED; } void usb_reset(USBPort *port) @@ -218,17 +221,6 @@ static int do_token_out(USBDevice *s, USBPacket *p) int usb_generic_handle_packet(USBDevice *s, USBPacket *p) { switch(p->pid) { - case USB_MSG_ATTACH: - s->state = USB_STATE_ATTACHED; - if (s->info->handle_attach) { - s->info->handle_attach(s); - } - return 0; - - case USB_MSG_DETACH: - s->state = USB_STATE_NOTATTACHED; - return 0; - case USB_MSG_RESET: s->remote_wakeup = 0; s->addr = 0; diff --git a/hw/usb.h b/hw/usb.h index 37f7d96..73155cf 100644 --- a/hw/usb.h +++ b/hw/usb.h @@ -37,8 +37,6 @@ #define USB_TOKEN_OUT 0xe1 /* host -> device */ /* specific usb messages, also sent in the 'pid' parameter */ -#define USB_MSG_ATTACH 0x100 -#define USB_MSG_DETACH 0x101 #define USB_MSG_RESET 0x102 #define USB_RET_NODEV (-1) -- 1.7.1