Commit d6372b6e authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Stefan Richter

firewire: core: fw_iso_resource_manage: return -EBUSY when out of resources

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: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 3a1f0a0e
...@@ -189,7 +189,7 @@ static int manage_bandwidth(struct fw_card *card, int irm_id, int generation, ...@@ -189,7 +189,7 @@ static int manage_bandwidth(struct fw_card *card, int irm_id, int generation,
for (try = 0; try < 5; try++) { for (try = 0; try < 5; try++) {
new = allocate ? old - bandwidth : old + bandwidth; new = allocate ? old - bandwidth : old + bandwidth;
if (new < 0 || new > BANDWIDTH_AVAILABLE_INITIAL) if (new < 0 || new > BANDWIDTH_AVAILABLE_INITIAL)
break; return -EBUSY;
data[0] = cpu_to_be32(old); data[0] = cpu_to_be32(old);
data[1] = cpu_to_be32(new); data[1] = cpu_to_be32(new);
...@@ -217,7 +217,7 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation, ...@@ -217,7 +217,7 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
u32 channels_mask, u64 offset, bool allocate, __be32 data[2]) u32 channels_mask, u64 offset, bool allocate, __be32 data[2])
{ {
__be32 c, all, old; __be32 c, all, old;
int i, retry = 5; int i, ret = -EIO, retry = 5;
old = all = allocate ? cpu_to_be32(~0) : 0; old = all = allocate ? cpu_to_be32(~0) : 0;
...@@ -225,6 +225,8 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation, ...@@ -225,6 +225,8 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
if (!(channels_mask & 1 << i)) if (!(channels_mask & 1 << i))
continue; continue;
ret = -EBUSY;
c = cpu_to_be32(1 << (31 - i)); c = cpu_to_be32(1 << (31 - i));
if ((old & c) != (all & c)) if ((old & c) != (all & c))
continue; continue;
...@@ -253,11 +255,13 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation, ...@@ -253,11 +255,13 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
if (retry) { if (retry) {
retry--; retry--;
i--; i--;
} else {
ret = -EIO;
} }
} }
} }
return -EIO; return ret;
} }
static void deallocate_channel(struct fw_card *card, int irm_id, static void deallocate_channel(struct fw_card *card, int irm_id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment