Skip to content

Commit

Permalink
firewire: ohci: optimize control bit checks
Browse files Browse the repository at this point in the history
Doing the endian conversion on the constant instead of the memory
field allows the compiler to do the conversion at compile time.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
  • Loading branch information
Clemens Ladisch authored and Stefan Richter committed Mar 18, 2012
1 parent b9b5bbf commit 90fcc89
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/firewire/ohci.c
Original file line number Diff line number Diff line change
Expand Up @@ -2728,7 +2728,7 @@ static int handle_ir_packet_per_buffer(struct context *context,
p = last + 1;
copy_iso_headers(ctx, p);

if (le16_to_cpu(last->control) & DESCRIPTOR_IRQ_ALWAYS) {
if (last->control & cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS)) {
ir_header = (__le32 *) p;
ctx->base.callback.sc(&ctx->base,
le32_to_cpu(ir_header[0]) & 0xffff,
Expand Down Expand Up @@ -2760,7 +2760,7 @@ static int handle_ir_buffer_fill(struct context *context,
le16_to_cpu(last->req_count),
DMA_FROM_DEVICE);

if (le16_to_cpu(last->control) & DESCRIPTOR_IRQ_ALWAYS)
if (last->control & cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS))
ctx->base.callback.mc(&ctx->base,
le32_to_cpu(last->data_address) +
le16_to_cpu(last->req_count),
Expand Down Expand Up @@ -2832,7 +2832,7 @@ static int handle_it_packet(struct context *context,
le16_to_cpu(pd->res_count));
ctx->header_length += 4;
}
if (le16_to_cpu(last->control) & DESCRIPTOR_IRQ_ALWAYS) {
if (last->control & cpu_to_le16(DESCRIPTOR_IRQ_ALWAYS)) {
ctx->base.callback.sc(&ctx->base, le16_to_cpu(last->res_count),
ctx->header_length, ctx->header,
ctx->base.callback_data);
Expand Down

0 comments on commit 90fcc89

Please sign in to comment.