aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-device.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-03-07 12:12:39 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-09 16:03:07 -0500
commit5f48047756339065df3e6fead381978abb0bc557 (patch)
treec13766ebd8900e6662e7117beea67da80363e28a /drivers/firewire/fw-device.c
parente254a4b45f265d9df120b83d5c2c9437902b601b (diff)
firewire: Iterate through units in a keventd callback for update callbacks.
We can't take the klist lock for the child device list in interrupt context. Signed-off-by: Kristian Høgsberg <krh@redhat.com> 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.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c
index e8f2dc3151bd..5599265da4a6 100644
--- a/drivers/firewire/fw-device.c
+++ b/drivers/firewire/fw-device.c
@@ -530,6 +530,14 @@ static int update_unit(struct device *dev, void *data)
530 return 0; 530 return 0;
531} 531}
532 532
533static void fw_device_update(struct work_struct *work)
534{
535 struct fw_device *device =
536 container_of(work, struct fw_device, work.work);
537
538 device_for_each_child(&device->device, NULL, update_unit);
539}
540
533void fw_node_event(struct fw_card *card, struct fw_node *node, int event) 541void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
534{ 542{
535 struct fw_device *device; 543 struct fw_device *device;
@@ -577,7 +585,10 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
577 device = node->data; 585 device = node->data;
578 device->node_id = node->node_id; 586 device->node_id = node->node_id;
579 device->generation = card->generation; 587 device->generation = card->generation;
580 device_for_each_child(&device->device, NULL, update_unit); 588 if (atomic_read(&device->state) == FW_DEVICE_RUNNING) {
589 PREPARE_DELAYED_WORK(&device->work, fw_device_update);
590 schedule_delayed_work(&device->work, 0);
591 }
581 break; 592 break;
582 593
583 case FW_NODE_DESTROYED: 594 case FW_NODE_DESTROYED:
@@ -597,8 +608,8 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
597 * to create the device. */ 608 * to create the device. */
598 device = node->data; 609 device = node->data;
599 if (atomic_xchg(&device->state, 610 if (atomic_xchg(&device->state,
600 FW_DEVICE_SHUTDOWN) == FW_DEVICE_RUNNING) { 611 FW_DEVICE_SHUTDOWN) == FW_DEVICE_RUNNING) {
601 INIT_DELAYED_WORK(&device->work, fw_device_shutdown); 612 PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown);
602 schedule_delayed_work(&device->work, 0); 613 schedule_delayed_work(&device->work, 0);
603 } 614 }
604 break; 615 break;