firewire: core: rename some variables
In manage_channel(), rename the variables "c" and "i" to the more expressive "bit" and "channel". Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
This commit is contained in:
parent
8fd2af11d2
commit
5aaffc65a2
|
@ -235,45 +235,45 @@ static int manage_bandwidth(struct fw_card *card, int irm_id, int generation,
|
||||||
static int manage_channel(struct fw_card *card, int irm_id, int generation,
|
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 bit, all, old;
|
||||||
int i, ret = -EIO, retry = 5;
|
int channel, ret = -EIO, retry = 5;
|
||||||
|
|
||||||
old = all = allocate ? cpu_to_be32(~0) : 0;
|
old = all = allocate ? cpu_to_be32(~0) : 0;
|
||||||
|
|
||||||
for (i = 0; i < 32; i++) {
|
for (channel = 0; channel < 32; channel++) {
|
||||||
if (!(channels_mask & 1 << i))
|
if (!(channels_mask & 1 << channel))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ret = -EBUSY;
|
ret = -EBUSY;
|
||||||
|
|
||||||
c = cpu_to_be32(1 << (31 - i));
|
bit = cpu_to_be32(1 << (31 - channel));
|
||||||
if ((old & c) != (all & c))
|
if ((old & bit) != (all & bit))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
data[0] = old;
|
data[0] = old;
|
||||||
data[1] = old ^ c;
|
data[1] = old ^ bit;
|
||||||
switch (fw_run_transaction(card, TCODE_LOCK_COMPARE_SWAP,
|
switch (fw_run_transaction(card, TCODE_LOCK_COMPARE_SWAP,
|
||||||
irm_id, generation, SCODE_100,
|
irm_id, generation, SCODE_100,
|
||||||
offset, data, 8)) {
|
offset, data, 8)) {
|
||||||
case RCODE_GENERATION:
|
case RCODE_GENERATION:
|
||||||
/* A generation change frees all channels. */
|
/* A generation change frees all channels. */
|
||||||
return allocate ? -EAGAIN : i;
|
return allocate ? -EAGAIN : channel;
|
||||||
|
|
||||||
case RCODE_COMPLETE:
|
case RCODE_COMPLETE:
|
||||||
if (data[0] == old)
|
if (data[0] == old)
|
||||||
return i;
|
return channel;
|
||||||
|
|
||||||
old = data[0];
|
old = data[0];
|
||||||
|
|
||||||
/* Is the IRM 1394a-2000 compliant? */
|
/* Is the IRM 1394a-2000 compliant? */
|
||||||
if ((data[0] & c) == (data[1] & c))
|
if ((data[0] & bit) == (data[1] & bit))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* 1394-1995 IRM, fall through to retry. */
|
/* 1394-1995 IRM, fall through to retry. */
|
||||||
default:
|
default:
|
||||||
if (retry) {
|
if (retry) {
|
||||||
retry--;
|
retry--;
|
||||||
i--;
|
channel--;
|
||||||
} else {
|
} else {
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue