aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi/hosts.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2005-09-06 14:04:26 +0200
committerJames Bottomley <jejb@mulgrave.(none)>2005-09-06 17:26:06 -0500
commitc5478def7a3a2dba9ceda452c2aa3539514d30a9 (patch)
treef007c87094d1fa3fede0cb10a665ecbaf1814223 /drivers/scsi/hosts.c
parent32993523dc59759ae6cb349e4d231d4cd2165329 (diff)
[SCSI] switch EH thread startup to the kthread API
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
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 8640ad1c17e..85503fad789 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -24,6 +24,7 @@
#include <linux/module.h>
#include <linux/blkdev.h>
#include <linux/kernel.h>
+#include <linux/kthread.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/init.h>
@@ -225,15 +226,8 @@ static void scsi_host_dev_release(struct device *dev)
struct Scsi_Host *shost = dev_to_shost(dev);
struct device *parent = dev->parent;
- if (shost->ehandler) {
- DECLARE_COMPLETION(sem);
- shost->eh_notify = &sem;
- shost->eh_kill = 1;
- up(shost->eh_wait);
- wait_for_completion(&sem);
- shost->eh_notify = NULL;
- }
-
+ if (shost->ehandler)
+ kthread_stop(shost->ehandler);
if (shost->work_q)
destroy_workqueue(shost->work_q);
@@ -263,7 +257,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
{
struct Scsi_Host *shost;
int gfp_mask = GFP_KERNEL, rval;
- DECLARE_COMPLETION(complete);
if (sht->unchecked_isa_dma && privsize)
gfp_mask |= __GFP_DMA;
@@ -369,12 +362,12 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
snprintf(shost->shost_classdev.class_id, BUS_ID_SIZE, "host%d",
shost->host_no);
- shost->eh_notify = &complete;
- rval = kernel_thread(scsi_error_handler, shost, 0);
- if (rval < 0)
+ shost->ehandler = kthread_run(scsi_error_handler, shost,
+ "scsi_eh_%d", shost->host_no);
+ if (IS_ERR(shost->ehandler)) {
+ rval = PTR_ERR(shost->ehandler);
goto fail_destroy_freelist;
- wait_for_completion(&complete);
- shost->eh_notify = NULL;
+ }
scsi_proc_hostdir_add(shost->hostt);
return shost;