Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 307579
b: refs/heads/master
c: db7494e
h: refs/heads/master
i:
  307577: 796d832
  307575: 09e51c8
v: v3
  • Loading branch information
Clemens Ladisch authored and Stefan Richter committed Apr 17, 2012
1 parent b3ace07 commit eb9f504
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d33ec3b55e91f1c285099fee731b79a722d10fe6
refs/heads/master: db7494e2ce616f2e39e877cf9143b7d873701ec6
40 changes: 19 additions & 21 deletions trunk/drivers/firewire/core-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,42 +1069,42 @@ static void fw_device_init(struct work_struct *work)
put_device(&device->device); /* our reference */
}

enum {
REREAD_BIB_ERROR,
REREAD_BIB_UNCHANGED,
REREAD_BIB_CHANGED,
};

/* Reread and compare bus info block and header of root directory */
static int reread_config_rom(struct fw_device *device, int generation)
static int reread_config_rom(struct fw_device *device, int generation,
bool *changed)
{
u32 q;
int i;
int i, rcode;

for (i = 0; i < 6; i++) {
if (read_rom(device, generation, i, &q) != RCODE_COMPLETE)
return REREAD_BIB_ERROR;
rcode = read_rom(device, generation, i, &q);
if (rcode != RCODE_COMPLETE)
return rcode;

if (i == 0 && q == 0)
/* inaccessible (see read_config_rom); retry later */
return REREAD_BIB_ERROR;
return RCODE_BUSY;

if (q != device->config_rom[i])
return REREAD_BIB_CHANGED;
if (q != device->config_rom[i]) {
*changed = true;
return RCODE_COMPLETE;
}
}

return REREAD_BIB_UNCHANGED;
*changed = false;
return RCODE_COMPLETE;
}

static void fw_device_refresh(struct work_struct *work)
{
struct fw_device *device =
container_of(work, struct fw_device, work.work);
struct fw_card *card = device->card;
int node_id = device->node_id;
int ret, node_id = device->node_id;
bool changed;

switch (reread_config_rom(device, device->generation)) {
case REREAD_BIB_ERROR:
ret = reread_config_rom(device, device->generation, &changed);
if (ret != RCODE_COMPLETE) {
if (device->config_rom_retries < MAX_RETRIES / 2 &&
atomic_read(&device->state) == FW_DEVICE_INITIALIZING) {
device->config_rom_retries++;
Expand All @@ -1113,8 +1113,9 @@ static void fw_device_refresh(struct work_struct *work)
return;
}
goto give_up;
}

case REREAD_BIB_UNCHANGED:
if (!changed) {
if (atomic_cmpxchg(&device->state,
FW_DEVICE_INITIALIZING,
FW_DEVICE_RUNNING) == FW_DEVICE_GONE)
Expand All @@ -1123,9 +1124,6 @@ static void fw_device_refresh(struct work_struct *work)
fw_device_update(work);
device->config_rom_retries = 0;
goto out;

case REREAD_BIB_CHANGED:
break;
}

/*
Expand Down

0 comments on commit eb9f504

Please sign in to comment.