aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2010-04-12 04:35:18 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2010-04-19 13:58:32 -0400
commitd6372b6e7c6142e6cc2108b3b850584cd7ade106 (patch)
tree14ae5783465c1f987de1d33e5a2a70db71acbb0a /drivers/firewire
parent3a1f0a0e3d871e3d3e08a1429009992151becda8 (diff)
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: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/core-iso.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c
index 34a513725c9e..9198e030e895 100644
--- a/drivers/firewire/core-iso.c
+++ b/drivers/firewire/core-iso.c
@@ -189,7 +189,7 @@ static int manage_bandwidth(struct fw_card *card, int irm_id, int generation,
189 for (try = 0; try < 5; try++) { 189 for (try = 0; try < 5; try++) {
190 new = allocate ? old - bandwidth : old + bandwidth; 190 new = allocate ? old - bandwidth : old + bandwidth;
191 if (new < 0 || new > BANDWIDTH_AVAILABLE_INITIAL) 191 if (new < 0 || new > BANDWIDTH_AVAILABLE_INITIAL)
192 break; 192 return -EBUSY;
193 193
194 data[0] = cpu_to_be32(old); 194 data[0] = cpu_to_be32(old);
195 data[1] = cpu_to_be32(new); 195 data[1] = cpu_to_be32(new);
@@ -217,7 +217,7 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
217 u32 channels_mask, u64 offset, bool allocate, __be32 data[2]) 217 u32 channels_mask, u64 offset, bool allocate, __be32 data[2])
218{ 218{
219 __be32 c, all, old; 219 __be32 c, all, old;
220 int i, retry = 5; 220 int i, ret = -EIO, retry = 5;
221 221
222 old = all = allocate ? cpu_to_be32(~0) : 0; 222 old = all = allocate ? cpu_to_be32(~0) : 0;
223 223
@@ -225,6 +225,8 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
225 if (!(channels_mask & 1 << i)) 225 if (!(channels_mask & 1 << i))
226 continue; 226 continue;
227 227
228 ret = -EBUSY;
229
228 c = cpu_to_be32(1 << (31 - i)); 230 c = cpu_to_be32(1 << (31 - i));
229 if ((old & c) != (all & c)) 231 if ((old & c) != (all & c))
230 continue; 232 continue;
@@ -253,11 +255,13 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
253 if (retry) { 255 if (retry) {
254 retry--; 256 retry--;
255 i--; 257 i--;
258 } else {
259 ret = -EIO;
256 } 260 }
257 } 261 }
258 } 262 }
259 263
260 return -EIO; 264 return ret;
261} 265}
262 266
263static void deallocate_channel(struct fw_card *card, int irm_id, 267static void deallocate_channel(struct fw_card *card, int irm_id,