drivers: usb_dc_rpi_pico: cleanup incorrect comment and condition

I believe this comment and condition may have found its way into the
rp2040 driver from other drivers where it makes more sense. For
example for the stm32 driver performing a read on the EP0_IN endpoint
turns it silently into a read on the EP0_OUT endpoint. As far as I can
tell, this really was only used to consume 0-length Status-Stages of
to_host control transfer in the other drivers.

Note that usb_dc_ep_start_read() is never called in an IN endpoint
in the rp2040 driver, and furthermore, even if it would have been
called like that, the current implementation would not do the silent
change into actually performing a read on the EP0_OUT endpoint instead,
so the condition and comment is just wrong.

Note that 0-length Status-Stage of to_host control transfers is
currently consumed in this driver by usb_dc_ep_read_continue().

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
This commit is contained in:
Purdea Andrei 2023-01-24 08:37:31 +02:00 committed by Stephanos Ioannidis
parent 3c00629bb6
commit 158ee9139c

View file

@ -370,8 +370,7 @@ int usb_dc_ep_start_read(uint8_t ep, size_t len)
LOG_DBG("ep 0x%02x len %d", ep, len); LOG_DBG("ep 0x%02x len %d", ep, len);
/* we flush USB_CONTROL_EP_IN by doing a 0 length receive on it */ if (!USB_EP_DIR_IS_OUT(ep)) {
if (!USB_EP_DIR_IS_OUT(ep) && (ep != USB_CONTROL_EP_IN || len)) {
LOG_ERR("invalid ep 0x%02x", ep); LOG_ERR("invalid ep 0x%02x", ep);
return -EINVAL; return -EINVAL;
} }