Skip to content

Commit

Permalink
firewire: core: fw_iso_resource_manage: return -EBUSY when out of res…
Browse files Browse the repository at this point in the history
…ources

Returning -EIO for all errors would not allow clients to determine if
the resource allocation process itself failed, or if the resources are
not available.  (The latter information is needed by CMP to synchronize
restoring of overlayed connections after a bus reset.)

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 Apr 19, 2010
1 parent 3a1f0a0 commit d6372b6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/firewire/core-iso.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static int manage_bandwidth(struct fw_card *card, int irm_id, int generation,
for (try = 0; try < 5; try++) {
new = allocate ? old - bandwidth : old + bandwidth;
if (new < 0 || new > BANDWIDTH_AVAILABLE_INITIAL)
break;
return -EBUSY;

data[0] = cpu_to_be32(old);
data[1] = cpu_to_be32(new);
Expand Down Expand Up @@ -217,14 +217,16 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
u32 channels_mask, u64 offset, bool allocate, __be32 data[2])
{
__be32 c, all, old;
int i, retry = 5;
int i, ret = -EIO, retry = 5;

old = all = allocate ? cpu_to_be32(~0) : 0;

for (i = 0; i < 32; i++) {
if (!(channels_mask & 1 << i))
continue;

ret = -EBUSY;

c = cpu_to_be32(1 << (31 - i));
if ((old & c) != (all & c))
continue;
Expand Down Expand Up @@ -253,11 +255,13 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
if (retry) {
retry--;
i--;
} else {
ret = -EIO;
}
}
}

return -EIO;
return ret;
}

static void deallocate_channel(struct fw_card *card, int irm_id,
Expand Down

0 comments on commit d6372b6

Please sign in to comment.