diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-01-27 04:34:55 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-03-09 16:02:49 -0500 |
commit | 641f8791f031d6133e5c3e9ce036b3e942416e9d (patch) | |
tree | f65db59e8cedd09da36a956234a93b73e42aab89 /drivers/firewire | |
parent | 0edeefd99fd31f74432aba5860f6ebcbde874dbf (diff) |
firewire: use atomic type for fw_device.state
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r-- | drivers/firewire/fw-card.c | 2 | ||||
-rw-r--r-- | drivers/firewire/fw-device.c | 6 | ||||
-rw-r--r-- | drivers/firewire/fw-device.h | 3 |
3 files changed, 6 insertions, 5 deletions
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c index f94874ce58af..7f5dc43ec131 100644 --- a/drivers/firewire/fw-card.c +++ b/drivers/firewire/fw-card.c | |||
@@ -302,7 +302,7 @@ fw_card_bm_work(struct work_struct *work) | |||
302 | /* Either link_on is false, or we failed to read the | 302 | /* Either link_on is false, or we failed to read the |
303 | * config rom. In either case, pick another root. */ | 303 | * config rom. In either case, pick another root. */ |
304 | new_root_id = card->local_node->node_id; | 304 | new_root_id = card->local_node->node_id; |
305 | } else if (root->state != FW_DEVICE_RUNNING) { | 305 | } else if (atomic_read(&root->state) != FW_DEVICE_RUNNING) { |
306 | /* If we haven't probed this device yet, bail out now | 306 | /* If we haven't probed this device yet, bail out now |
307 | * and let's try again once that's done. */ | 307 | * and let's try again once that's done. */ |
308 | spin_unlock_irqrestore(&card->lock, flags); | 308 | spin_unlock_irqrestore(&card->lock, flags); |
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c index 4ea8d4d08a61..85b6f2cfa414 100644 --- a/drivers/firewire/fw-device.c +++ b/drivers/firewire/fw-device.c | |||
@@ -494,7 +494,7 @@ static void fw_device_init(struct work_struct *work) | |||
494 | * necessary. We have to use the atomic cmpxchg here to avoid | 494 | * necessary. We have to use the atomic cmpxchg here to avoid |
495 | * racing with the FW_NODE_DESTROYED case in | 495 | * racing with the FW_NODE_DESTROYED case in |
496 | * fw_node_event(). */ | 496 | * fw_node_event(). */ |
497 | if (cmpxchg(&device->state, | 497 | if (atomic_cmpxchg(&device->state, |
498 | FW_DEVICE_INITIALIZING, | 498 | FW_DEVICE_INITIALIZING, |
499 | FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN) | 499 | FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN) |
500 | fw_device_shutdown(&device->work.work); | 500 | fw_device_shutdown(&device->work.work); |
@@ -551,7 +551,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event) | |||
551 | * device_for_each_child() in FW_NODE_UPDATED is | 551 | * device_for_each_child() in FW_NODE_UPDATED is |
552 | * doesn't freak out. */ | 552 | * doesn't freak out. */ |
553 | device_initialize(&device->device); | 553 | device_initialize(&device->device); |
554 | device->state = FW_DEVICE_INITIALIZING; | 554 | atomic_set(&device->state, FW_DEVICE_INITIALIZING); |
555 | device->card = fw_card_get(card); | 555 | device->card = fw_card_get(card); |
556 | device->node = fw_node_get(node); | 556 | device->node = fw_node_get(node); |
557 | device->node_id = node->node_id; | 557 | device->node_id = node->node_id; |
@@ -596,7 +596,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event) | |||
596 | * the device in shutdown state to have that code fail | 596 | * the device in shutdown state to have that code fail |
597 | * to create the device. */ | 597 | * to create the device. */ |
598 | device = node->data; | 598 | device = node->data; |
599 | if (xchg(&device->state, | 599 | if (atomic_xchg(&device->state, |
600 | FW_DEVICE_SHUTDOWN) == FW_DEVICE_RUNNING) { | 600 | FW_DEVICE_SHUTDOWN) == FW_DEVICE_RUNNING) { |
601 | INIT_DELAYED_WORK(&device->work, fw_device_shutdown); | 601 | INIT_DELAYED_WORK(&device->work, fw_device_shutdown); |
602 | schedule_delayed_work(&device->work, 0); | 602 | schedule_delayed_work(&device->work, 0); |
diff --git a/drivers/firewire/fw-device.h b/drivers/firewire/fw-device.h index 5399b48f5538..402a785ceedb 100644 --- a/drivers/firewire/fw-device.h +++ b/drivers/firewire/fw-device.h | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <linux/fs.h> | 25 | #include <linux/fs.h> |
26 | #include <linux/cdev.h> | 26 | #include <linux/cdev.h> |
27 | #include <asm/atomic.h> | ||
27 | 28 | ||
28 | enum fw_device_state { | 29 | enum fw_device_state { |
29 | FW_DEVICE_INITIALIZING, | 30 | FW_DEVICE_INITIALIZING, |
@@ -32,7 +33,7 @@ enum fw_device_state { | |||
32 | }; | 33 | }; |
33 | 34 | ||
34 | struct fw_device { | 35 | struct fw_device { |
35 | int state; | 36 | atomic_t state; |
36 | struct fw_node *node; | 37 | struct fw_node *node; |
37 | int node_id; | 38 | int node_id; |
38 | int generation; | 39 | int generation; |