summaryrefslogtreecommitdiff
path: root/drivers/firewire/fw-device.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2009-05-13 21:42:14 +0200
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-05-17 14:13:47 +0200
commit92368890d551794ee8d7e90477d8498bb7f82a9b (patch)
tree0c9fe72c0d770ce4ac358235fafd18803415b1ac /drivers/firewire/fw-device.c
parent32a0f488ce5e8a9a148491f15edc508ab5e8265b (diff)
downloadlwn-92368890d551794ee8d7e90477d8498bb7f82a9b.tar.gz
lwn-92368890d551794ee8d7e90477d8498bb7f82a9b.zip
firewire: core: improve check for local node
My recently added test for a device being local in fw-cdev.c got it slightly wrong: Comparisons of node IDs are only valid if the generation is current, which I forgot to check. Normally, serialization by card->lock takes care of this, but a device in FW_DEVICE_GONE state will necessarily have a wrong generation and invalid node_id. The "is it local?" check is made 100% correct and simpler now by means of a struct fw_device flag which is set at fw_device creation. Besides the fw-cdev site which was to be fixed, there is another site which can make use of the new flag, and an RFC-2734 driver will benefit from it too. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-device.c')
-rw-r--r--drivers/firewire/fw-device.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c
index a47e2129d83d..a38a68b97b58 100644
--- a/drivers/firewire/fw-device.c
+++ b/drivers/firewire/fw-device.c
@@ -1042,6 +1042,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
device->node = fw_node_get(node);
device->node_id = node->node_id;
device->generation = card->generation;
+ device->is_local = node == card->local_node;
mutex_init(&device->client_list_mutex);
INIT_LIST_HEAD(&device->client_list);
@@ -1075,7 +1076,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
FW_DEVICE_INITIALIZING) == FW_DEVICE_RUNNING) {
PREPARE_DELAYED_WORK(&device->work, fw_device_refresh);
schedule_delayed_work(&device->work,
- node == card->local_node ? 0 : INITIAL_DELAY);
+ device->is_local ? 0 : INITIAL_DELAY);
}
break;