usb-xhci: switch to usb_find_device()
Switch over xHCI to use the new usb_find_device() function for device lookup. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
87e043f17e
commit
e74495e3ad
@ -1385,6 +1385,14 @@ static int xhci_complete_packet(XHCITransfer *xfer, int ret)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static USBDevice *xhci_find_device(XHCIPort *port, uint8_t addr)
|
||||||
|
{
|
||||||
|
if (!(port->portsc & PORTSC_PED)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return usb_find_device(&port->port, addr);
|
||||||
|
}
|
||||||
|
|
||||||
static int xhci_fire_ctl_transfer(XHCIState *xhci, XHCITransfer *xfer)
|
static int xhci_fire_ctl_transfer(XHCIState *xhci, XHCITransfer *xfer)
|
||||||
{
|
{
|
||||||
XHCITRB *trb_setup, *trb_status;
|
XHCITRB *trb_setup, *trb_status;
|
||||||
@ -1444,7 +1452,7 @@ static int xhci_fire_ctl_transfer(XHCIState *xhci, XHCITransfer *xfer)
|
|||||||
xfer->data_length = wLength;
|
xfer->data_length = wLength;
|
||||||
|
|
||||||
port = &xhci->ports[xhci->slots[xfer->slotid-1].port-1];
|
port = &xhci->ports[xhci->slots[xfer->slotid-1].port-1];
|
||||||
dev = port->port.dev;
|
dev = xhci_find_device(port, xhci->slots[xfer->slotid-1].devaddr);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
fprintf(stderr, "xhci: slot %d port %d has no device\n", xfer->slotid,
|
fprintf(stderr, "xhci: slot %d port %d has no device\n", xfer->slotid,
|
||||||
xhci->slots[xfer->slotid-1].port);
|
xhci->slots[xfer->slotid-1].port);
|
||||||
@ -1502,7 +1510,7 @@ static int xhci_submit(XHCIState *xhci, XHCITransfer *xfer, XHCIEPContext *epctx
|
|||||||
}
|
}
|
||||||
|
|
||||||
port = &xhci->ports[xhci->slots[xfer->slotid-1].port-1];
|
port = &xhci->ports[xhci->slots[xfer->slotid-1].port-1];
|
||||||
dev = port->port.dev;
|
dev = xhci_find_device(port, xhci->slots[xfer->slotid-1].devaddr);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
fprintf(stderr, "xhci: slot %d port %d has no device\n", xfer->slotid,
|
fprintf(stderr, "xhci: slot %d port %d has no device\n", xfer->slotid,
|
||||||
xhci->slots[xfer->slotid-1].port);
|
xhci->slots[xfer->slotid-1].port);
|
||||||
|
Loading…
Reference in New Issue
Block a user