diff options
author | Christoph Hellwig <hch@lst.de> | 2007-05-23 17:56:45 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-05-29 05:49:05 -0400 |
commit | b68a890fa3cd977365fda2b1f1ec4e8dc58baddf (patch) | |
tree | b261cf1876349df5a0f334d859952e59a393ff8b /drivers/scsi | |
parent | c420bc9f09a0926b708c3edb27eacba434a4f4ba (diff) |
[SCSI] pluto: Use wait_for_completion_timeout.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/pluto.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/scsi/pluto.c b/drivers/scsi/pluto.c index 3b2e1a53e6e2..d953d43fe2e6 100644 --- a/drivers/scsi/pluto.c +++ b/drivers/scsi/pluto.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/completion.h> | ||
7 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
8 | #include <linux/delay.h> | 9 | #include <linux/delay.h> |
9 | #include <linux/types.h> | 10 | #include <linux/types.h> |
@@ -50,16 +51,10 @@ static struct ctrl_inquiry { | |||
50 | } *fcs __initdata; | 51 | } *fcs __initdata; |
51 | static int fcscount __initdata = 0; | 52 | static int fcscount __initdata = 0; |
52 | static atomic_t fcss __initdata = ATOMIC_INIT(0); | 53 | static atomic_t fcss __initdata = ATOMIC_INIT(0); |
53 | DECLARE_MUTEX_LOCKED(fc_sem); | 54 | static DECLARE_COMPLETION(fc_detect_complete); |
54 | 55 | ||
55 | static int pluto_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd); | 56 | static int pluto_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd); |
56 | 57 | ||
57 | static void __init pluto_detect_timeout(unsigned long data) | ||
58 | { | ||
59 | PLND(("Timeout\n")) | ||
60 | up(&fc_sem); | ||
61 | } | ||
62 | |||
63 | static void __init pluto_detect_done(Scsi_Cmnd *SCpnt) | 58 | static void __init pluto_detect_done(Scsi_Cmnd *SCpnt) |
64 | { | 59 | { |
65 | /* Do nothing */ | 60 | /* Do nothing */ |
@@ -69,7 +64,7 @@ static void __init pluto_detect_scsi_done(Scsi_Cmnd *SCpnt) | |||
69 | { | 64 | { |
70 | PLND(("Detect done %08lx\n", (long)SCpnt)) | 65 | PLND(("Detect done %08lx\n", (long)SCpnt)) |
71 | if (atomic_dec_and_test (&fcss)) | 66 | if (atomic_dec_and_test (&fcss)) |
72 | up(&fc_sem); | 67 | complete(&fc_detect_complete); |
73 | } | 68 | } |
74 | 69 | ||
75 | int pluto_slave_configure(struct scsi_device *device) | 70 | int pluto_slave_configure(struct scsi_device *device) |
@@ -96,7 +91,6 @@ int __init pluto_detect(struct scsi_host_template *tpnt) | |||
96 | int i, retry, nplutos; | 91 | int i, retry, nplutos; |
97 | fc_channel *fc; | 92 | fc_channel *fc; |
98 | struct scsi_device dev; | 93 | struct scsi_device dev; |
99 | DEFINE_TIMER(fc_timer, pluto_detect_timeout, 0, 0); | ||
100 | 94 | ||
101 | tpnt->proc_name = "pluto"; | 95 | tpnt->proc_name = "pluto"; |
102 | fcscount = 0; | 96 | fcscount = 0; |
@@ -187,15 +181,11 @@ int __init pluto_detect(struct scsi_host_template *tpnt) | |||
187 | } | 181 | } |
188 | } | 182 | } |
189 | 183 | ||
190 | fc_timer.expires = jiffies + 10 * HZ; | 184 | wait_for_completion_timeout(&fc_detect_complete, 10 * HZ); |
191 | add_timer(&fc_timer); | ||
192 | |||
193 | down(&fc_sem); | ||
194 | PLND(("Woken up\n")) | 185 | PLND(("Woken up\n")) |
195 | if (!atomic_read(&fcss)) | 186 | if (!atomic_read(&fcss)) |
196 | break; /* All fc channels have answered us */ | 187 | break; /* All fc channels have answered us */ |
197 | } | 188 | } |
198 | del_timer_sync(&fc_timer); | ||
199 | 189 | ||
200 | PLND(("Finished search\n")) | 190 | PLND(("Finished search\n")) |
201 | for (i = 0, nplutos = 0; i < fcscount; i++) { | 191 | for (i = 0, nplutos = 0; i < fcscount; i++) { |