MFp4 //depot/projects/usb@159946
Some cancelable flags are always true. Substitute these away. These cancelable flags were mostly useful with the root HUB which is now handled differently. Submitted by: Hans Petter Selasky
This commit is contained in:
parent
3b01d5130c
commit
4565300d56
@ -1499,8 +1499,6 @@ struct usb2_pipe_methods at91dci_device_bulk_methods =
|
||||
.close = at91dci_device_bulk_close,
|
||||
.enter = at91dci_device_bulk_enter,
|
||||
.start = at91dci_device_bulk_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1538,8 +1536,6 @@ struct usb2_pipe_methods at91dci_device_ctrl_methods =
|
||||
.close = at91dci_device_ctrl_close,
|
||||
.enter = at91dci_device_ctrl_enter,
|
||||
.start = at91dci_device_ctrl_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1577,8 +1573,6 @@ struct usb2_pipe_methods at91dci_device_intr_methods =
|
||||
.close = at91dci_device_intr_close,
|
||||
.enter = at91dci_device_intr_enter,
|
||||
.start = at91dci_device_intr_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1661,8 +1655,6 @@ struct usb2_pipe_methods at91dci_device_isoc_fs_methods =
|
||||
.close = at91dci_device_isoc_fs_close,
|
||||
.enter = at91dci_device_isoc_fs_enter,
|
||||
.start = at91dci_device_isoc_fs_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
|
@ -1376,8 +1376,6 @@ struct usb2_pipe_methods atmegadci_device_non_isoc_methods =
|
||||
.close = atmegadci_device_non_isoc_close,
|
||||
.enter = atmegadci_device_non_isoc_enter,
|
||||
.start = atmegadci_device_non_isoc_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1464,8 +1462,6 @@ struct usb2_pipe_methods atmegadci_device_isoc_fs_methods =
|
||||
.close = atmegadci_device_isoc_fs_close,
|
||||
.enter = atmegadci_device_isoc_fs_enter,
|
||||
.start = atmegadci_device_isoc_fs_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
|
@ -2210,8 +2210,6 @@ struct usb2_pipe_methods ehci_device_bulk_methods =
|
||||
.close = ehci_device_bulk_close,
|
||||
.enter = ehci_device_bulk_enter,
|
||||
.start = ehci_device_bulk_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -2253,8 +2251,6 @@ struct usb2_pipe_methods ehci_device_ctrl_methods =
|
||||
.close = ehci_device_ctrl_close,
|
||||
.enter = ehci_device_ctrl_enter,
|
||||
.start = ehci_device_ctrl_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -2351,8 +2347,6 @@ struct usb2_pipe_methods ehci_device_intr_methods =
|
||||
.close = ehci_device_intr_close,
|
||||
.enter = ehci_device_intr_enter,
|
||||
.start = ehci_device_intr_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -2636,8 +2630,6 @@ struct usb2_pipe_methods ehci_device_isoc_fs_methods =
|
||||
.close = ehci_device_isoc_fs_close,
|
||||
.enter = ehci_device_isoc_fs_enter,
|
||||
.start = ehci_device_isoc_fs_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -2904,8 +2896,6 @@ struct usb2_pipe_methods ehci_device_isoc_hs_methods =
|
||||
.close = ehci_device_isoc_hs_close,
|
||||
.enter = ehci_device_isoc_hs_enter,
|
||||
.start = ehci_device_isoc_hs_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
|
@ -1899,8 +1899,6 @@ struct usb2_pipe_methods musbotg_device_bulk_methods =
|
||||
.close = musbotg_device_bulk_close,
|
||||
.enter = musbotg_device_bulk_enter,
|
||||
.start = musbotg_device_bulk_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1938,8 +1936,6 @@ struct usb2_pipe_methods musbotg_device_ctrl_methods =
|
||||
.close = musbotg_device_ctrl_close,
|
||||
.enter = musbotg_device_ctrl_enter,
|
||||
.start = musbotg_device_ctrl_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1977,8 +1973,6 @@ struct usb2_pipe_methods musbotg_device_intr_methods =
|
||||
.close = musbotg_device_intr_close,
|
||||
.enter = musbotg_device_intr_enter,
|
||||
.start = musbotg_device_intr_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -2068,8 +2062,6 @@ struct usb2_pipe_methods musbotg_device_isoc_methods =
|
||||
.close = musbotg_device_isoc_close,
|
||||
.enter = musbotg_device_isoc_enter,
|
||||
.start = musbotg_device_isoc_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
|
@ -1720,8 +1720,6 @@ struct usb2_pipe_methods ohci_device_bulk_methods =
|
||||
.close = ohci_device_bulk_close,
|
||||
.enter = ohci_device_bulk_enter,
|
||||
.start = ohci_device_bulk_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1763,8 +1761,6 @@ struct usb2_pipe_methods ohci_device_ctrl_methods =
|
||||
.close = ohci_device_ctrl_close,
|
||||
.enter = ohci_device_ctrl_enter,
|
||||
.start = ohci_device_ctrl_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1837,8 +1833,6 @@ struct usb2_pipe_methods ohci_device_intr_methods =
|
||||
.close = ohci_device_intr_close,
|
||||
.enter = ohci_device_intr_enter,
|
||||
.start = ohci_device_intr_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -2047,8 +2041,6 @@ struct usb2_pipe_methods ohci_device_isoc_methods =
|
||||
.close = ohci_device_isoc_close,
|
||||
.enter = ohci_device_isoc_enter,
|
||||
.start = ohci_device_isoc_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
|
@ -1940,8 +1940,6 @@ struct usb2_pipe_methods uhci_device_bulk_methods =
|
||||
.close = uhci_device_bulk_close,
|
||||
.enter = uhci_device_bulk_enter,
|
||||
.start = uhci_device_bulk_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -2004,8 +2002,6 @@ struct usb2_pipe_methods uhci_device_ctrl_methods =
|
||||
.close = uhci_device_ctrl_close,
|
||||
.enter = uhci_device_ctrl_enter,
|
||||
.start = uhci_device_ctrl_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -2095,8 +2091,6 @@ struct usb2_pipe_methods uhci_device_intr_methods =
|
||||
.close = uhci_device_intr_close,
|
||||
.enter = uhci_device_intr_enter,
|
||||
.start = uhci_device_intr_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -2305,8 +2299,6 @@ struct usb2_pipe_methods uhci_device_isoc_methods =
|
||||
.close = uhci_device_isoc_close,
|
||||
.enter = uhci_device_isoc_enter,
|
||||
.start = uhci_device_isoc_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
|
@ -1542,8 +1542,6 @@ struct usb2_pipe_methods uss820dci_device_bulk_methods =
|
||||
.close = uss820dci_device_bulk_close,
|
||||
.enter = uss820dci_device_bulk_enter,
|
||||
.start = uss820dci_device_bulk_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1581,8 +1579,6 @@ struct usb2_pipe_methods uss820dci_device_ctrl_methods =
|
||||
.close = uss820dci_device_ctrl_close,
|
||||
.enter = uss820dci_device_ctrl_enter,
|
||||
.start = uss820dci_device_ctrl_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1620,8 +1616,6 @@ struct usb2_pipe_methods uss820dci_device_intr_methods =
|
||||
.close = uss820dci_device_intr_close,
|
||||
.enter = uss820dci_device_intr_enter,
|
||||
.start = uss820dci_device_intr_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
@ -1704,8 +1698,6 @@ struct usb2_pipe_methods uss820dci_device_isoc_fs_methods =
|
||||
.close = uss820dci_device_isoc_fs_close,
|
||||
.enter = uss820dci_device_isoc_fs_enter,
|
||||
.start = uss820dci_device_isoc_fs_start,
|
||||
.enter_is_cancelable = 1,
|
||||
.start_is_cancelable = 1,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
|
@ -108,20 +108,15 @@ struct usb2_pipe_methods {
|
||||
|
||||
/* Mandatory USB Device and Host mode callbacks: */
|
||||
|
||||
void (*open) (struct usb2_xfer *xfer);
|
||||
void (*close) (struct usb2_xfer *xfer);
|
||||
usb2_callback_t *open;
|
||||
usb2_callback_t *close;
|
||||
|
||||
void (*enter) (struct usb2_xfer *xfer);
|
||||
void (*start) (struct usb2_xfer *xfer);
|
||||
usb2_callback_t *enter;
|
||||
usb2_callback_t *start;
|
||||
|
||||
/* Optional */
|
||||
|
||||
void *info;
|
||||
|
||||
/* Flags */
|
||||
|
||||
uint8_t enter_is_cancelable:1;
|
||||
uint8_t start_is_cancelable:1;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1541,18 +1541,14 @@ usb2_pipe_enter(struct usb2_xfer *xfer)
|
||||
/* enter the transfer */
|
||||
(pipe->methods->enter) (xfer);
|
||||
|
||||
/* check cancelability */
|
||||
if (pipe->methods->enter_is_cancelable) {
|
||||
xfer->flags_int.can_cancel_immed = 1;
|
||||
/* check for transfer error */
|
||||
if (xfer->error) {
|
||||
/* some error has happened */
|
||||
usb2_transfer_done(xfer, 0);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
xfer->flags_int.can_cancel_immed = 0;
|
||||
xfer->flags_int.can_cancel_immed = 1;
|
||||
|
||||
/* check for transfer error */
|
||||
if (xfer->error) {
|
||||
/* some error has happened */
|
||||
usb2_transfer_done(xfer, 0);
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
return;
|
||||
}
|
||||
|
||||
/* start the transfer */
|
||||
@ -1866,8 +1862,8 @@ usb2_callback_wrapper(struct usb2_xfer_queue *pq)
|
||||
struct usb2_xfer *xfer = pq->curr;
|
||||
struct usb2_xfer_root *info = xfer->xroot;
|
||||
|
||||
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
|
||||
if (!mtx_owned(xfer->xroot->xfer_mtx)) {
|
||||
USB_BUS_LOCK_ASSERT(info->bus, MA_OWNED);
|
||||
if (!mtx_owned(info->xfer_mtx)) {
|
||||
/*
|
||||
* Cases that end up here:
|
||||
*
|
||||
@ -1898,22 +1894,22 @@ usb2_callback_wrapper(struct usb2_xfer_queue *pq)
|
||||
/* get next USB transfer in the queue */
|
||||
info->done_q.curr = NULL;
|
||||
|
||||
USB_BUS_UNLOCK(xfer->xroot->bus);
|
||||
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_NOTOWNED);
|
||||
USB_BUS_UNLOCK(info->bus);
|
||||
USB_BUS_LOCK_ASSERT(info->bus, MA_NOTOWNED);
|
||||
|
||||
/* set correct USB state for callback */
|
||||
if (!xfer->flags_int.transferring) {
|
||||
xfer->usb2_state = USB_ST_SETUP;
|
||||
if (!xfer->flags_int.started) {
|
||||
/* we got stopped before we even got started */
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
USB_BUS_LOCK(info->bus);
|
||||
goto done;
|
||||
}
|
||||
} else {
|
||||
|
||||
if (usb2_callback_wrapper_sub(xfer)) {
|
||||
/* the callback has been deferred */
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
USB_BUS_LOCK(info->bus);
|
||||
goto done;
|
||||
}
|
||||
#if USB_HAVE_POWERD
|
||||
@ -1941,7 +1937,7 @@ usb2_callback_wrapper(struct usb2_xfer_queue *pq)
|
||||
(xfer->callback) (xfer);
|
||||
|
||||
/* pickup the USB mutex again */
|
||||
USB_BUS_LOCK(xfer->xroot->bus);
|
||||
USB_BUS_LOCK(info->bus);
|
||||
|
||||
/*
|
||||
* Check if we got started after that we got cancelled, but
|
||||
@ -1963,7 +1959,7 @@ usb2_callback_wrapper(struct usb2_xfer_queue *pq)
|
||||
(!xfer->flags_int.transferring)) {
|
||||
/* "usb2_transfer_drain()" is waiting for end of transfer */
|
||||
xfer->flags_int.draining = 0;
|
||||
usb2_cv_broadcast(&xfer->xroot->cv_drain);
|
||||
usb2_cv_broadcast(&info->cv_drain);
|
||||
}
|
||||
|
||||
/* do the next callback, if any */
|
||||
@ -2122,15 +2118,12 @@ usb2_transfer_start_cb(void *arg)
|
||||
/* start the transfer */
|
||||
(pipe->methods->start) (xfer);
|
||||
|
||||
/* check cancelability */
|
||||
if (pipe->methods->start_is_cancelable) {
|
||||
xfer->flags_int.can_cancel_immed = 1;
|
||||
if (xfer->error) {
|
||||
/* some error has happened */
|
||||
usb2_transfer_done(xfer, 0);
|
||||
}
|
||||
} else {
|
||||
xfer->flags_int.can_cancel_immed = 0;
|
||||
xfer->flags_int.can_cancel_immed = 1;
|
||||
|
||||
/* check for error */
|
||||
if (xfer->error) {
|
||||
/* some error has happened */
|
||||
usb2_transfer_done(xfer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2276,15 +2269,12 @@ usb2_pipe_start(struct usb2_xfer_queue *pq)
|
||||
/* start USB transfer */
|
||||
(pipe->methods->start) (xfer);
|
||||
|
||||
/* check cancelability */
|
||||
if (pipe->methods->start_is_cancelable) {
|
||||
xfer->flags_int.can_cancel_immed = 1;
|
||||
if (xfer->error) {
|
||||
/* some error has happened */
|
||||
usb2_transfer_done(xfer, 0);
|
||||
}
|
||||
} else {
|
||||
xfer->flags_int.can_cancel_immed = 0;
|
||||
xfer->flags_int.can_cancel_immed = 1;
|
||||
|
||||
/* check for error */
|
||||
if (xfer->error) {
|
||||
/* some error has happened */
|
||||
usb2_transfer_done(xfer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user