/* Either link_on is false, or we failed to read the
* config rom. In either case, pick another root. */
new_root_id = card->local_node->node_id;
- } else if (root->state != FW_DEVICE_RUNNING) {
+ } else if (atomic_read(&root->state) != FW_DEVICE_RUNNING) {
/* If we haven't probed this device yet, bail out now
* and let's try again once that's done. */
spin_unlock_irqrestore(&card->lock, flags);
* necessary. We have to use the atomic cmpxchg here to avoid
* racing with the FW_NODE_DESTROYED case in
* fw_node_event(). */
- if (cmpxchg(&device->state,
+ if (atomic_cmpxchg(&device->state,
FW_DEVICE_INITIALIZING,
FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN)
fw_device_shutdown(&device->work.work);
* device_for_each_child() in FW_NODE_UPDATED is
* doesn't freak out. */
device_initialize(&device->device);
- device->state = FW_DEVICE_INITIALIZING;
+ atomic_set(&device->state, FW_DEVICE_INITIALIZING);
device->card = fw_card_get(card);
device->node = fw_node_get(node);
device->node_id = node->node_id;
* the device in shutdown state to have that code fail
* to create the device. */
device = node->data;
- if (xchg(&device->state,
+ if (atomic_xchg(&device->state,
FW_DEVICE_SHUTDOWN) == FW_DEVICE_RUNNING) {
INIT_DELAYED_WORK(&device->work, fw_device_shutdown);
schedule_delayed_work(&device->work, 0);