aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hosts.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/hosts.c')
-rw-r--r--drivers/scsi/hosts.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 8640ad1c17e2..85503fad789a 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -24,6 +24,7 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/blkdev.h> 25#include <linux/blkdev.h>
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/kthread.h>
27#include <linux/string.h> 28#include <linux/string.h>
28#include <linux/mm.h> 29#include <linux/mm.h>
29#include <linux/init.h> 30#include <linux/init.h>
@@ -225,15 +226,8 @@ static void scsi_host_dev_release(struct device *dev)
225 struct Scsi_Host *shost = dev_to_shost(dev); 226 struct Scsi_Host *shost = dev_to_shost(dev);
226 struct device *parent = dev->parent; 227 struct device *parent = dev->parent;
227 228
228 if (shost->ehandler) { 229 if (shost->ehandler)
229 DECLARE_COMPLETION(sem); 230 kthread_stop(shost->ehandler);
230 shost->eh_notify = &sem;
231 shost->eh_kill = 1;
232 up(shost->eh_wait);
233 wait_for_completion(&sem);
234 shost->eh_notify = NULL;
235 }
236
237 if (shost->work_q) 231 if (shost->work_q)
238 destroy_workqueue(shost->work_q); 232 destroy_workqueue(shost->work_q);
239 233
@@ -263,7 +257,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
263{ 257{
264 struct Scsi_Host *shost; 258 struct Scsi_Host *shost;
265 int gfp_mask = GFP_KERNEL, rval; 259 int gfp_mask = GFP_KERNEL, rval;
266 DECLARE_COMPLETION(complete);
267 260
268 if (sht->unchecked_isa_dma && privsize) 261 if (sht->unchecked_isa_dma && privsize)
269 gfp_mask |= __GFP_DMA; 262 gfp_mask |= __GFP_DMA;
@@ -369,12 +362,12 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
369 snprintf(shost->shost_classdev.class_id, BUS_ID_SIZE, "host%d", 362 snprintf(shost->shost_classdev.class_id, BUS_ID_SIZE, "host%d",
370 shost->host_no); 363 shost->host_no);
371 364
372 shost->eh_notify = &complete; 365 shost->ehandler = kthread_run(scsi_error_handler, shost,
373 rval = kernel_thread(scsi_error_handler, shost, 0); 366 "scsi_eh_%d", shost->host_no);
374 if (rval < 0) 367 if (IS_ERR(shost->ehandler)) {
368 rval = PTR_ERR(shost->ehandler);
375 goto fail_destroy_freelist; 369 goto fail_destroy_freelist;
376 wait_for_completion(&complete); 370 }
377 shost->eh_notify = NULL;
378 371
379 scsi_proc_hostdir_add(shost->hostt); 372 scsi_proc_hostdir_add(shost->hostt);
380 return shost; 373 return shost;