aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-card.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire/fw-card.c')
-rw-r--r--drivers/firewire/fw-card.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c
index e6395b298508..a03462750b95 100644
--- a/drivers/firewire/fw-card.c
+++ b/drivers/firewire/fw-card.c
@@ -18,6 +18,7 @@
18 18
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/delay.h>
21#include <linux/device.h> 22#include <linux/device.h>
22#include <linux/mutex.h> 23#include <linux/mutex.h>
23#include <linux/crc-itu-t.h> 24#include <linux/crc-itu-t.h>
@@ -398,6 +399,7 @@ fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver,
398 static atomic_t index = ATOMIC_INIT(-1); 399 static atomic_t index = ATOMIC_INIT(-1);
399 400
400 kref_init(&card->kref); 401 kref_init(&card->kref);
402 atomic_set(&card->device_count, 0);
401 card->index = atomic_inc_return(&index); 403 card->index = atomic_inc_return(&index);
402 card->driver = driver; 404 card->driver = driver;
403 card->device = device; 405 card->device = device;
@@ -528,8 +530,14 @@ fw_core_remove_card(struct fw_card *card)
528 card->driver = &dummy_driver; 530 card->driver = &dummy_driver;
529 531
530 fw_destroy_nodes(card); 532 fw_destroy_nodes(card);
531 flush_scheduled_work(); 533 /*
534 * Wait for all device workqueue jobs to finish. Otherwise the
535 * firewire-core module could be unloaded before the jobs ran.
536 */
537 while (atomic_read(&card->device_count) > 0)
538 msleep(100);
532 539
540 cancel_delayed_work_sync(&card->work);
533 fw_flush_transactions(card); 541 fw_flush_transactions(card);
534 del_timer_sync(&card->flush_timer); 542 del_timer_sync(&card->flush_timer);
535 543