Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe74c71f authored by Andrew Vasquez's avatar Andrew Vasquez Committed by James Bottomley
Browse files

[SCSI] qla2xxx: Replace schedule_timeout().



From: Nishanth Aravamudan <nacc@us.ibm.com>

Replace schedule_timeout() with
msleep()/msleep_interruptible() as appropriate, to guarantee the task
delays as expected.

Signed-off-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: default avatarDomen Puncer <domen@coderock.org>
Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 86cd6baa
Loading
Loading
Loading
Loading
+11 −14
Original line number Original line Diff line number Diff line
@@ -502,14 +502,13 @@ qla24xx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
static int
static int
qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
{
{
#define ABORT_POLLING_PERIOD	HZ
#define ABORT_POLLING_PERIOD	1000
#define ABORT_WAIT_ITER		((10 * HZ) / (ABORT_POLLING_PERIOD))
#define ABORT_WAIT_ITER		((10 * 1000) / (ABORT_POLLING_PERIOD))
	unsigned long wait_iter = ABORT_WAIT_ITER;
	unsigned long wait_iter = ABORT_WAIT_ITER;
	int ret = QLA_SUCCESS;
	int ret = QLA_SUCCESS;


	while (CMD_SP(cmd)) {
	while (CMD_SP(cmd)) {
		set_current_state(TASK_UNINTERRUPTIBLE);
		msleep(ABORT_POLLING_PERIOD);
		schedule_timeout(ABORT_POLLING_PERIOD);


		if (--wait_iter)
		if (--wait_iter)
			break;
			break;
@@ -1960,7 +1959,7 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
{
{
	struct list_head	*fcpl, *fcptemp;
	struct list_head	*fcpl, *fcptemp;
	fc_port_t	*fcport;
	fc_port_t	*fcport;
	unsigned long	wtime;/* max wait time if mbx cmd is busy. */
	unsigned int	wtime;/* max wait time if mbx cmd is busy. */


	if (ha == NULL) {
	if (ha == NULL) {
		/* error */
		/* error */
@@ -1969,11 +1968,9 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
	}
	}


	/* Make sure all other threads are stopped. */
	/* Make sure all other threads are stopped. */
	wtime = 60 * HZ;
	wtime = 60 * 1000;
	while (ha->dpc_wait && wtime) {
	while (ha->dpc_wait && wtime)
		set_current_state(TASK_INTERRUPTIBLE);
		wtime = msleep_interruptible(wtime);
		wtime = schedule_timeout(wtime);
	}


	/* free ioctl memory */
	/* free ioctl memory */
	qla2x00_free_ioctl_mem(ha);
	qla2x00_free_ioctl_mem(ha);
@@ -2504,15 +2501,15 @@ qla2x00_timer(scsi_qla_host_t *ha)
int
int
qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout)
qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout)
{
{
	const unsigned int step = HZ/10;
	const unsigned int step = 100; /* msecs */
	unsigned int iterations = jiffies_to_msecs(timeout)/100;


	do {
	do {
		if (!down_trylock(sema))
		if (!down_trylock(sema))
			return 0;
			return 0;
		set_current_state(TASK_INTERRUPTIBLE);
		if (msleep_interruptible(step))
		if (schedule_timeout(step))
			break;
			break;
	} while ((timeout -= step) > 0);
	} while (--iterations >= 0);


	return -ETIMEDOUT;
	return -ETIMEDOUT;
}
}