[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/28] usb: kill USB_MSG_{ATTACH,DETACH}
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 04/28] usb: kill USB_MSG_{ATTACH,DETACH} |
Date: |
Fri, 10 Feb 2012 12:43:00 +0100 |
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 <address@hidden>
---
hw/usb.c | 14 +++-----------
hw/usb.h | 2 --
2 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/hw/usb.c b/hw/usb.c
index c3ff5b7..800dd83 100644
--- a/hw/usb.c
+++ b/hw/usb.c
@@ -35,7 +35,8 @@ 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;
+ usb_device_handle_attach(dev);
}
void usb_detach(USBPort *port)
@@ -45,7 +46,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,15 +219,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;
- usb_device_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 13e7c8e..0bd9098 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -40,8 +40,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
- [Qemu-devel] [PULL 00/28] usb patch queue, Gerd Hoffmann, 2012/02/10
- [Qemu-devel] [PATCH 02/28] usb-ehci: Clear the portstatus powner bit on device disconnect, Gerd Hoffmann, 2012/02/10
- [Qemu-devel] [PATCH 04/28] usb: kill USB_MSG_{ATTACH,DETACH},
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 08/28] usb-hub: implement find_device, Gerd Hoffmann, 2012/02/10
- [Qemu-devel] [PATCH 01/28] usb-uhci: implement bandwidth management, Gerd Hoffmann, 2012/02/10
- [Qemu-devel] [PATCH 07/28] usb: add usb_find_device(), Gerd Hoffmann, 2012/02/10
- [Qemu-devel] [PATCH 22/28] usb: add USBBusOps->wakeup_endpoint, Gerd Hoffmann, 2012/02/10
- [Qemu-devel] [PATCH 10/28] usb-uhci: switch to usb_find_device(), Gerd Hoffmann, 2012/02/10
- [Qemu-devel] [PATCH 03/28] usb-redir: Add the posibility to filter out certain devices from redirecion, Gerd Hoffmann, 2012/02/10
- [Qemu-devel] [PATCH 18/28] usb: add USBEndpoint->{nr,pid}, Gerd Hoffmann, 2012/02/10
- [Qemu-devel] [PATCH 06/28] usb: kill usb_send_msg, Gerd Hoffmann, 2012/02/10
- [Qemu-devel] [PATCH 14/28] usb-xhci: switch to usb_find_device(), Gerd Hoffmann, 2012/02/10
- [Qemu-devel] [PATCH 23/28] xhci: signal low- and fullspeed support, Gerd Hoffmann, 2012/02/10