aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/ohci.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index a2fc64cd8b81..1a49743347fb 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -2676,24 +2676,26 @@ static void ohci_write_csr(struct fw_card *card, int csr_offset, u32 value)
2676 } 2676 }
2677} 2677}
2678 2678
2679static void copy_iso_headers(struct iso_context *ctx, void *p) 2679static void copy_iso_headers(struct iso_context *ctx, const u32 *dma_hdr)
2680{ 2680{
2681 int i = ctx->header_length; 2681 u32 *ctx_hdr;
2682 2682
2683 if (i + ctx->base.header_size > PAGE_SIZE) 2683 if (ctx->header_length + ctx->base.header_size > PAGE_SIZE)
2684 return; 2684 return;
2685 2685
2686 ctx_hdr = ctx->header + ctx->header_length;
2687
2686 /* 2688 /*
2687 * The two iso header quadlets are byteswapped to little 2689 * The two iso header quadlets are byteswapped to little
2688 * endian by the controller, but we want to present them 2690 * endian by the controller, but we want to present them
2689 * as big endian for consistency with the bus endianness. 2691 * as big endian for consistency with the bus endianness.
2690 */ 2692 */
2691 if (ctx->base.header_size > 0) 2693 if (ctx->base.header_size > 0)
2692 *(u32 *) (ctx->header + i) = __swab32(*(u32 *) (p + 4)); 2694 ctx_hdr[0] = swab32(dma_hdr[1]); /* iso packet header */
2693 if (ctx->base.header_size > 4) 2695 if (ctx->base.header_size > 4)
2694 *(u32 *) (ctx->header + i + 4) = __swab32(*(u32 *) p); 2696 ctx_hdr[1] = swab32(dma_hdr[0]); /* timestamp */
2695 if (ctx->base.header_size > 8) 2697 if (ctx->base.header_size > 8)
2696 memcpy(ctx->header + i + 8, p + 8, ctx->base.header_size - 8); 2698 memcpy(&ctx_hdr[2], &dma_hdr[2], ctx->base.header_size - 8);
2697 ctx->header_length += ctx->base.header_size; 2699 ctx->header_length += ctx->base.header_size;
2698} 2700}
2699 2701
@@ -2812,8 +2814,8 @@ static int handle_it_packet(struct context *context,
2812{ 2814{
2813 struct iso_context *ctx = 2815 struct iso_context *ctx =
2814 container_of(context, struct iso_context, context); 2816 container_of(context, struct iso_context, context);
2815 int i;
2816 struct descriptor *pd; 2817 struct descriptor *pd;
2818 __be32 *ctx_hdr;
2817 2819
2818 for (pd = d; pd <= last; pd++) 2820 for (pd = d; pd <= last; pd++)
2819 if (pd->transfer_status) 2821 if (pd->transfer_status)
@@ -2824,10 +2826,10 @@ static int handle_it_packet(struct context *context,
2824 2826
2825 sync_it_packet_for_cpu(context, d); 2827 sync_it_packet_for_cpu(context, d);
2826 2828
2827 i = ctx->header_length; 2829 if (ctx->header_length + 4 < PAGE_SIZE) {
2828 if (i + 4 < PAGE_SIZE) { 2830 ctx_hdr = ctx->header + ctx->header_length;
2829 /* Present this value as big-endian to match the receive code */ 2831 /* Present this value as big-endian to match the receive code */
2830 *(__be32 *)(ctx->header + i) = cpu_to_be32( 2832 *ctx_hdr = cpu_to_be32(
2831 ((u32)le16_to_cpu(pd->transfer_status) << 16) | 2833 ((u32)le16_to_cpu(pd->transfer_status) << 16) |
2832 le16_to_cpu(pd->res_count)); 2834 le16_to_cpu(pd->res_count));
2833 ctx->header_length += 4; 2835 ctx->header_length += 4;