aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci.c
diff options
context:
space:
mode:
authorMatt Evans <matt@ozlabs.org>2011-05-31 20:22:55 -0400
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2011-06-02 19:37:47 -0400
commitf5960b698eb50a39fce1a066dc19a6a5a1148e16 (patch)
treed1f08656be5ffd40f4268d874801f91016508e3e /drivers/usb/host/xhci.c
parent55922c9d1b84b89cb946c777fddccb3247e7df2c (diff)
xhci: Remove some unnecessary casts and tidy some endian swap code
Some of the recently-added cpu_to_leXX and leXX_to_cpu made things somewhat messy; this patch neatens some of these areas, removing unnecessary casts in those parts also. In some places (where Y & Z are constants) a comparison of (leXX_to_cpu(X) & Y) == Z has been replaced with (X & cpu_to_leXX(Y)) == cpu_to_leXX(Z). The endian reversal of the constants should wash out at compile time. Signed-off-by: Matt Evans <matt@ozlabs.org> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Diffstat (limited to 'drivers/usb/host/xhci.c')
-rw-r--r--drivers/usb/host/xhci.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index d9660eb97eb9..743cf80debb1 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1333,8 +1333,8 @@ int xhci_drop_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
1333 /* If the HC already knows the endpoint is disabled, 1333 /* If the HC already knows the endpoint is disabled,
1334 * or the HCD has noted it is disabled, ignore this request 1334 * or the HCD has noted it is disabled, ignore this request
1335 */ 1335 */
1336 if ((le32_to_cpu(ep_ctx->ep_info) & EP_STATE_MASK) == 1336 if (((ep_ctx->ep_info & cpu_to_le32(EP_STATE_MASK)) ==
1337 EP_STATE_DISABLED || 1337 cpu_to_le32(EP_STATE_DISABLED)) ||
1338 le32_to_cpu(ctrl_ctx->drop_flags) & 1338 le32_to_cpu(ctrl_ctx->drop_flags) &
1339 xhci_get_endpoint_flag(&ep->desc)) { 1339 xhci_get_endpoint_flag(&ep->desc)) {
1340 xhci_warn(xhci, "xHCI %s called with disabled ep %p\n", 1340 xhci_warn(xhci, "xHCI %s called with disabled ep %p\n",
@@ -1725,8 +1725,7 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci,
1725 /* Enqueue pointer can be left pointing to the link TRB, 1725 /* Enqueue pointer can be left pointing to the link TRB,
1726 * we must handle that 1726 * we must handle that
1727 */ 1727 */
1728 if ((le32_to_cpu(command->command_trb->link.control) 1728 if (TRB_TYPE_LINK_LE32(command->command_trb->link.control))
1729 & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK))
1730 command->command_trb = 1729 command->command_trb =
1731 xhci->cmd_ring->enq_seg->next->trbs; 1730 xhci->cmd_ring->enq_seg->next->trbs;
1732 1731
@@ -2519,8 +2518,7 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
2519 /* Enqueue pointer can be left pointing to the link TRB, 2518 /* Enqueue pointer can be left pointing to the link TRB,
2520 * we must handle that 2519 * we must handle that
2521 */ 2520 */
2522 if ((le32_to_cpu(reset_device_cmd->command_trb->link.control) 2521 if (TRB_TYPE_LINK_LE32(reset_device_cmd->command_trb->link.control))
2523 & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK))
2524 reset_device_cmd->command_trb = 2522 reset_device_cmd->command_trb =
2525 xhci->cmd_ring->enq_seg->next->trbs; 2523 xhci->cmd_ring->enq_seg->next->trbs;
2526 2524