Skip to content

Commit

Permalink
USB: dummy-hcd: use usb_urb_dir_in instead of usb_pipein
Browse files Browse the repository at this point in the history
Commit fea3409 ("USB: add direction bit to urb->transfer_flags") has
added a usb_urb_dir_in() helper function that can be used to determine
the direction of the URB. With that patch USB_DIR_IN control requests with
wLength == 0 are considered out requests by real USB HCDs. This patch
changes dummy-hcd to use the usb_urb_dir_in() helper to match that
behavior.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
  • Loading branch information
Andrey Konovalov authored and Felipe Balbi committed Oct 22, 2019
1 parent 1bff4a4 commit 15ac1d9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/usb/gadget/udc/dummy_hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ static int dummy_perform_transfer(struct urb *urb, struct dummy_request *req,
u32 this_sg;
bool next_sg;

to_host = usb_pipein(urb->pipe);
to_host = usb_urb_dir_in(urb);
rbuf = req->req.buf + req->req.actual;

if (!urb->num_sgs) {
Expand Down Expand Up @@ -1409,7 +1409,7 @@ static int transfer(struct dummy_hcd *dum_hcd, struct urb *urb,

/* FIXME update emulated data toggle too */

to_host = usb_pipein(urb->pipe);
to_host = usb_urb_dir_in(urb);
if (unlikely(len == 0))
is_short = 1;
else {
Expand Down Expand Up @@ -1830,7 +1830,7 @@ static void dummy_timer(struct timer_list *t)

/* find the gadget's ep for this request (if configured) */
address = usb_pipeendpoint (urb->pipe);
if (usb_pipein(urb->pipe))
if (usb_urb_dir_in(urb))
address |= USB_DIR_IN;
ep = find_endpoint(dum, address);
if (!ep) {
Expand Down Expand Up @@ -2385,7 +2385,7 @@ static inline ssize_t show_urb(char *buf, size_t size, struct urb *urb)
s = "?";
break;
} s; }),
ep, ep ? (usb_pipein(urb->pipe) ? "in" : "out") : "",
ep, ep ? (usb_urb_dir_in(urb) ? "in" : "out") : "",
({ char *s; \
switch (usb_pipetype(urb->pipe)) { \
case PIPE_CONTROL: \
Expand Down

0 comments on commit 15ac1d9

Please sign in to comment.