diff options
Diffstat (limited to 'drivers/firewire/sbp2.c')
-rw-r--r-- | drivers/firewire/sbp2.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index 98dbbda3ad41..d485cdd8cbac 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
@@ -820,20 +820,25 @@ static void sbp2_release_target(struct kref *kref) | |||
820 | fw_device_put(device); | 820 | fw_device_put(device); |
821 | } | 821 | } |
822 | 822 | ||
823 | static struct workqueue_struct *sbp2_wq; | 823 | static void sbp2_target_get(struct sbp2_target *tgt) |
824 | { | ||
825 | kref_get(&tgt->kref); | ||
826 | } | ||
824 | 827 | ||
825 | static void sbp2_target_put(struct sbp2_target *tgt) | 828 | static void sbp2_target_put(struct sbp2_target *tgt) |
826 | { | 829 | { |
827 | kref_put(&tgt->kref, sbp2_release_target); | 830 | kref_put(&tgt->kref, sbp2_release_target); |
828 | } | 831 | } |
829 | 832 | ||
833 | static struct workqueue_struct *sbp2_wq; | ||
834 | |||
830 | /* | 835 | /* |
831 | * Always get the target's kref when scheduling work on one its units. | 836 | * Always get the target's kref when scheduling work on one its units. |
832 | * Each workqueue job is responsible to call sbp2_target_put() upon return. | 837 | * Each workqueue job is responsible to call sbp2_target_put() upon return. |
833 | */ | 838 | */ |
834 | static void sbp2_queue_work(struct sbp2_logical_unit *lu, unsigned long delay) | 839 | static void sbp2_queue_work(struct sbp2_logical_unit *lu, unsigned long delay) |
835 | { | 840 | { |
836 | kref_get(&lu->tgt->kref); | 841 | sbp2_target_get(lu->tgt); |
837 | if (!queue_delayed_work(sbp2_wq, &lu->work, delay)) | 842 | if (!queue_delayed_work(sbp2_wq, &lu->work, delay)) |
838 | sbp2_target_put(lu->tgt); | 843 | sbp2_target_put(lu->tgt); |
839 | } | 844 | } |