aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/NCR5380.c
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2016-01-03 16:05:21 +1100
committerMartin K. Petersen <martin.petersen@oracle.com>2016-01-06 21:42:56 -0500
commit0ad0eff98fec3c940ec199047ff580abaaa5bb1a (patch)
treeedbaaf6760250383f1bf45fe39e48a1422985126 /drivers/scsi/NCR5380.c
parentncr5380: Cleanup bogus {request,release}_region() calls (diff)
downloadlinux-dev-0ad0eff98fec3c940ec199047ff580abaaa5bb1a.tar.xz
linux-dev-0ad0eff98fec3c940ec199047ff580abaaa5bb1a.zip
ncr5380: Introduce unbound workqueue
Allocate a work queue that will permit busy waiting and sleeping. This means NCR5380_init() can potentially fail, so add this error path. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Reviewed-by: Hannes Reinecke <hare@suse.com> Tested-by: Ondrej Zary <linux@rainbow-software.org> Tested-by: Michael Schmitz <schmitzmic@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/NCR5380.c')
-rw-r--r--drivers/scsi/NCR5380.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 103c23e6d565..a66fffc83475 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -514,7 +514,7 @@ static int should_disconnect(unsigned char cmd)
static void NCR5380_set_timer(struct NCR5380_hostdata *hostdata, unsigned long timeout)
{
hostdata->time_expires = jiffies + timeout;
- schedule_delayed_work(&hostdata->coroutine, timeout);
+ queue_delayed_work(hostdata->work_q, &hostdata->coroutine, timeout);
}
@@ -791,7 +791,12 @@ static int NCR5380_init(struct Scsi_Host *instance, int flags)
hostdata->disconnected_queue = NULL;
INIT_DELAYED_WORK(&hostdata->coroutine, NCR5380_main);
-
+ hostdata->work_q = alloc_workqueue("ncr5380_%d",
+ WQ_UNBOUND | WQ_MEM_RECLAIM,
+ 1, instance->host_no);
+ if (!hostdata->work_q)
+ return -ENOMEM;
+
/* The CHECK code seems to break the 53C400. Will check it later maybe */
if (flags & FLAG_NCR53C400)
hostdata->flags = FLAG_HAS_LAST_BYTE_SENT | flags;
@@ -872,6 +877,7 @@ static void NCR5380_exit(struct Scsi_Host *instance)
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
cancel_delayed_work_sync(&hostdata->coroutine);
+ destroy_workqueue(hostdata->work_q);
}
/**
@@ -932,7 +938,7 @@ static int NCR5380_queue_command_lck(struct scsi_cmnd *cmd, void (*done) (struct
/* Run the coroutine if it isn't already running. */
/* Kick off command processing */
- schedule_delayed_work(&hostdata->coroutine, 0);
+ queue_delayed_work(hostdata->work_q, &hostdata->coroutine, 0);
return 0;
}
@@ -1128,7 +1134,8 @@ static irqreturn_t NCR5380_intr(int dummy, void *dev_id)
} /* if BASR_IRQ */
spin_unlock_irqrestore(instance->host_lock, flags);
if(!done)
- schedule_delayed_work(&hostdata->coroutine, 0);
+ queue_delayed_work(hostdata->work_q,
+ &hostdata->coroutine, 0);
} while (!done);
return IRQ_HANDLED;
}