Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6:
firewire: core: fix sleep in atomic context due to driver core change

+20 -16
+7 -6
drivers/firewire/fw-card.c
··· 209 unsigned long flags; 210 int root_id, new_root_id, irm_id, gap_count, generation, grace, rcode; 211 bool do_reset = false; 212 __be32 lock_data[2]; 213 214 spin_lock_irqsave(&card->lock, flags); ··· 226 227 generation = card->generation; 228 root_device = root_node->data; 229 - if (root_device) 230 - fw_device_get(root_device); 231 root_id = root_node->node_id; 232 grace = time_after(jiffies, card->reset_jiffies + DIV_ROUND_UP(HZ, 10)); 233 ··· 311 * config rom. In either case, pick another root. 312 */ 313 new_root_id = local_node->node_id; 314 - } else if (atomic_read(&root_device->state) != FW_DEVICE_RUNNING) { 315 /* 316 * If we haven't probed this device yet, bail out now 317 * and let's try again once that's done. 318 */ 319 spin_unlock_irqrestore(&card->lock, flags); 320 goto out; 321 - } else if (root_device->cmc) { 322 /* 323 * FIXME: I suppose we should set the cmstr bit in the 324 * STATE_CLEAR register of this node, as described in ··· 365 fw_core_initiate_bus_reset(card, 1); 366 } 367 out: 368 - if (root_device) 369 - fw_device_put(root_device); 370 fw_node_put(root_node); 371 fw_node_put(local_node); 372 out_put_card:
··· 209 unsigned long flags; 210 int root_id, new_root_id, irm_id, gap_count, generation, grace, rcode; 211 bool do_reset = false; 212 + bool root_device_is_running; 213 + bool root_device_is_cmc; 214 __be32 lock_data[2]; 215 216 spin_lock_irqsave(&card->lock, flags); ··· 224 225 generation = card->generation; 226 root_device = root_node->data; 227 + root_device_is_running = root_device && 228 + atomic_read(&root_device->state) == FW_DEVICE_RUNNING; 229 + root_device_is_cmc = root_device && root_device->cmc; 230 root_id = root_node->node_id; 231 grace = time_after(jiffies, card->reset_jiffies + DIV_ROUND_UP(HZ, 10)); 232 ··· 308 * config rom. In either case, pick another root. 309 */ 310 new_root_id = local_node->node_id; 311 + } else if (!root_device_is_running) { 312 /* 313 * If we haven't probed this device yet, bail out now 314 * and let's try again once that's done. 315 */ 316 spin_unlock_irqrestore(&card->lock, flags); 317 goto out; 318 + } else if (root_device_is_cmc) { 319 /* 320 * FIXME: I suppose we should set the cmstr bit in the 321 * STATE_CLEAR register of this node, as described in ··· 362 fw_core_initiate_bus_reset(card, 1); 363 } 364 out: 365 fw_node_put(root_node); 366 fw_node_put(local_node); 367 out_put_card:
+13 -10
drivers/firewire/fw-device.c
··· 159 160 /* 161 * Take the card lock so we don't set this to NULL while a 162 - * FW_NODE_UPDATED callback is being handled. 163 */ 164 spin_lock_irqsave(&card->lock, flags); 165 device->node->data = NULL; ··· 696 return; 697 } 698 699 - err = -ENOMEM; 700 701 fw_device_get(device); 702 down_write(&fw_device_rwsem); 703 - if (idr_pre_get(&fw_device_idr, GFP_KERNEL)) 704 - err = idr_get_new(&fw_device_idr, device, &minor); 705 up_write(&fw_device_rwsem); 706 707 if (err < 0) ··· 913 914 /* 915 * Do minimal intialization of the device here, the 916 - * rest will happen in fw_device_init(). We need the 917 - * card and node so we can read the config rom and we 918 - * need to do device_initialize() now so 919 - * device_for_each_child() in FW_NODE_UPDATED is 920 - * doesn't freak out. 921 */ 922 - device_initialize(&device->device); 923 atomic_set(&device->state, FW_DEVICE_INITIALIZING); 924 device->card = fw_card_get(card); 925 device->node = fw_node_get(node);
··· 159 160 /* 161 * Take the card lock so we don't set this to NULL while a 162 + * FW_NODE_UPDATED callback is being handled or while the 163 + * bus manager work looks at this node. 164 */ 165 spin_lock_irqsave(&card->lock, flags); 166 device->node->data = NULL; ··· 695 return; 696 } 697 698 + device_initialize(&device->device); 699 700 fw_device_get(device); 701 down_write(&fw_device_rwsem); 702 + err = idr_pre_get(&fw_device_idr, GFP_KERNEL) ? 703 + idr_get_new(&fw_device_idr, device, &minor) : 704 + -ENOMEM; 705 up_write(&fw_device_rwsem); 706 707 if (err < 0) ··· 911 912 /* 913 * Do minimal intialization of the device here, the 914 + * rest will happen in fw_device_init(). 915 + * 916 + * Attention: A lot of things, even fw_device_get(), 917 + * cannot be done before fw_device_init() finished! 918 + * You can basically just check device->state and 919 + * schedule work until then, but only while holding 920 + * card->lock. 921 */ 922 atomic_set(&device->state, FW_DEVICE_INITIALIZING); 923 device->card = fw_card_get(card); 924 device->node = fw_node_get(node);