blob: cab446ebcf733b60dd8e00eedc3b38e6ba835284 [file] [log] [blame]
From e579a27a32a7da75d8ea58d8e2919cfa724200f6 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.balbi@linux.intel.com>
Date: Mon, 23 Jan 2017 14:20:21 +0200
Subject: [PATCH 208/255] usb: host: xhci: convert several if() to a single
switch statement
when getting endpoint type, a switch statement looks
better than a series of if () branches. There are no
functional changes with this patch, cleanup only.
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c0e625c41abbcc12c4981823889e3dc126252fb5)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
drivers/usb/host/xhci-mem.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1414,14 +1414,16 @@ static u32 xhci_get_endpoint_type(struct
in = usb_endpoint_dir_in(&ep->desc);
- if (usb_endpoint_xfer_control(&ep->desc))
+ switch (usb_endpoint_type(&ep->desc)) {
+ case USB_ENDPOINT_XFER_CONTROL:
return CTRL_EP;
- if (usb_endpoint_xfer_bulk(&ep->desc))
+ case USB_ENDPOINT_XFER_BULK:
return in ? BULK_IN_EP : BULK_OUT_EP;
- if (usb_endpoint_xfer_isoc(&ep->desc))
+ case USB_ENDPOINT_XFER_ISOC:
return in ? ISOC_IN_EP : ISOC_OUT_EP;
- if (usb_endpoint_xfer_int(&ep->desc))
+ case USB_ENDPOINT_XFER_INT:
return in ? INT_IN_EP : INT_OUT_EP;
+ }
return 0;
}