Skip to content

Commit 0ff8fbc

Browse files
cladischStefan Richter
authored andcommitted
firewire: ohci: optimize find_branch_descriptor()
When z==2, the condition "key == 2" is superfluous because it cannot occur without "b == 3", as a descriptor with b!=3 and key==2 would be an OUTPUT_MORE_IMMEDIATE descriptor which cannot be used alone. Also remove magic numbers and needless computations on the b field. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
1 parent da28947 commit 0ff8fbc

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/firewire/ohci.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,13 +1006,12 @@ static void ar_context_run(struct ar_context *ctx)
10061006

10071007
static struct descriptor *find_branch_descriptor(struct descriptor *d, int z)
10081008
{
1009-
int b, key;
1009+
__le16 branch;
10101010

1011-
b = (le16_to_cpu(d->control) & DESCRIPTOR_BRANCH_ALWAYS) >> 2;
1012-
key = (le16_to_cpu(d->control) & DESCRIPTOR_KEY_IMMEDIATE) >> 8;
1011+
branch = d->control & cpu_to_le16(DESCRIPTOR_BRANCH_ALWAYS);
10131012

10141013
/* figure out which descriptor the branch address goes in */
1015-
if (z == 2 && (b == 3 || key == 2))
1014+
if (z == 2 && branch == cpu_to_le16(DESCRIPTOR_BRANCH_ALWAYS))
10161015
return d;
10171016
else
10181017
return d + z - 1;

0 commit comments

Comments
 (0)