xhci: Remove some unnecessary casts and tidy some endian swap code
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / usb / host / xhci.c
index d9660eb97eb9a4ede02ff49111b46d71d4ac89bb..743cf80debb1b3a53d2087a1fbda38b742e785da 100644 (file)
@@ -1333,8 +1333,8 @@ int xhci_drop_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
        /* If the HC already knows the endpoint is disabled,
         * or the HCD has noted it is disabled, ignore this request
         */
-       if ((le32_to_cpu(ep_ctx->ep_info) & EP_STATE_MASK) ==
-           EP_STATE_DISABLED ||
+       if (((ep_ctx->ep_info & cpu_to_le32(EP_STATE_MASK)) ==
+            cpu_to_le32(EP_STATE_DISABLED)) ||
            le32_to_cpu(ctrl_ctx->drop_flags) &
            xhci_get_endpoint_flag(&ep->desc)) {
                xhci_warn(xhci, "xHCI %s called with disabled ep %p\n",
@@ -1725,8 +1725,7 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci,
                /* Enqueue pointer can be left pointing to the link TRB,
                 * we must handle that
                 */
-               if ((le32_to_cpu(command->command_trb->link.control)
-                    & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK))
+               if (TRB_TYPE_LINK_LE32(command->command_trb->link.control))
                        command->command_trb =
                                xhci->cmd_ring->enq_seg->next->trbs;
 
@@ -2519,8 +2518,7 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
        /* Enqueue pointer can be left pointing to the link TRB,
         * we must handle that
         */
-       if ((le32_to_cpu(reset_device_cmd->command_trb->link.control)
-            & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK))
+       if (TRB_TYPE_LINK_LE32(reset_device_cmd->command_trb->link.control))
                reset_device_cmd->command_trb =
                        xhci->cmd_ring->enq_seg->next->trbs;