Commit a9a3047d authored by Nishanth Aravamudan's avatar Nishanth Aravamudan Committed by Linus Torvalds

[PATCH] drivers/scsi: fix-up schedule_timeout() usage

Use schedule_timeout_uninterruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.
Signed-off-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6521018d
...@@ -606,10 +606,7 @@ static int __init NCR5380_probe_irq(struct Scsi_Host *instance, int possible) ...@@ -606,10 +606,7 @@ static int __init NCR5380_probe_irq(struct Scsi_Host *instance, int possible)
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_SEL); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_SEL);
while (probe_irq == SCSI_IRQ_NONE && time_before(jiffies, timeout)) while (probe_irq == SCSI_IRQ_NONE && time_before(jiffies, timeout))
{ schedule_timeout_uninterruptible(1);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
}
NCR5380_write(SELECT_ENABLE_REG, 0); NCR5380_write(SELECT_ENABLE_REG, 0);
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
......
...@@ -183,8 +183,7 @@ static int rkt_sync_cmd(struct aac_dev *dev, u32 command, ...@@ -183,8 +183,7 @@ static int rkt_sync_cmd(struct aac_dev *dev, u32 command,
/* /*
* Yield the processor in case we are slow * Yield the processor in case we are slow
*/ */
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
} }
if (ok != 1) { if (ok != 1) {
/* /*
...@@ -452,8 +451,7 @@ int aac_rkt_init(struct aac_dev *dev) ...@@ -452,8 +451,7 @@ int aac_rkt_init(struct aac_dev *dev)
dev->name, instance, status); dev->name, instance, status);
goto error_iounmap; goto error_iounmap;
} }
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
} }
if (request_irq(dev->scsi_host_ptr->irq, aac_rkt_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev)<0) if (request_irq(dev->scsi_host_ptr->irq, aac_rkt_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev)<0)
{ {
......
...@@ -183,8 +183,7 @@ static int rx_sync_cmd(struct aac_dev *dev, u32 command, ...@@ -183,8 +183,7 @@ static int rx_sync_cmd(struct aac_dev *dev, u32 command,
/* /*
* Yield the processor in case we are slow * Yield the processor in case we are slow
*/ */
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
} }
if (ok != 1) { if (ok != 1) {
/* /*
...@@ -452,8 +451,7 @@ int aac_rx_init(struct aac_dev *dev) ...@@ -452,8 +451,7 @@ int aac_rx_init(struct aac_dev *dev)
dev->name, instance, status); dev->name, instance, status);
goto error_iounmap; goto error_iounmap;
} }
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
} }
if (request_irq(dev->scsi_host_ptr->irq, aac_rx_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev)<0) if (request_irq(dev->scsi_host_ptr->irq, aac_rx_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev)<0)
{ {
......
...@@ -189,8 +189,7 @@ static int sa_sync_cmd(struct aac_dev *dev, u32 command, ...@@ -189,8 +189,7 @@ static int sa_sync_cmd(struct aac_dev *dev, u32 command,
ok = 1; ok = 1;
break; break;
} }
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
} }
if (ok != 1) if (ok != 1)
...@@ -325,8 +324,7 @@ int aac_sa_init(struct aac_dev *dev) ...@@ -325,8 +324,7 @@ int aac_sa_init(struct aac_dev *dev)
name, instance, status); name, instance, status);
goto error_iounmap; goto error_iounmap;
} }
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
} }
if (request_irq(dev->scsi_host_ptr->irq, aac_sa_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev ) < 0) { if (request_irq(dev->scsi_host_ptr->irq, aac_sa_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev ) < 0) {
......
...@@ -1218,8 +1218,7 @@ static s32 adpt_i2o_post_this(adpt_hba* pHba, u32* data, int len) ...@@ -1218,8 +1218,7 @@ static s32 adpt_i2o_post_this(adpt_hba* pHba, u32* data, int len)
printk(KERN_WARNING"dpti%d: Timeout waiting for message frame!\n", pHba->unit); printk(KERN_WARNING"dpti%d: Timeout waiting for message frame!\n", pHba->unit);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
} while(m == EMPTY_QUEUE); } while(m == EMPTY_QUEUE);
msg = pHba->msg_addr_virt + m; msg = pHba->msg_addr_virt + m;
...@@ -1294,8 +1293,7 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba) ...@@ -1294,8 +1293,7 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba)
printk(KERN_WARNING"Timeout waiting for message!\n"); printk(KERN_WARNING"Timeout waiting for message!\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
} while (m == EMPTY_QUEUE); } while (m == EMPTY_QUEUE);
status = (u8*)kmalloc(4, GFP_KERNEL|ADDR32); status = (u8*)kmalloc(4, GFP_KERNEL|ADDR32);
...@@ -1327,8 +1325,7 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba) ...@@ -1327,8 +1325,7 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba)
return -ETIMEDOUT; return -ETIMEDOUT;
} }
rmb(); rmb();
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
} }
if(*status == 0x01 /*I2O_EXEC_IOP_RESET_IN_PROGRESS*/) { if(*status == 0x01 /*I2O_EXEC_IOP_RESET_IN_PROGRESS*/) {
...@@ -1345,8 +1342,7 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba) ...@@ -1345,8 +1342,7 @@ static s32 adpt_i2o_reset_hba(adpt_hba* pHba)
printk(KERN_ERR "%s:Timeout waiting for IOP Reset.\n",pHba->name); printk(KERN_ERR "%s:Timeout waiting for IOP Reset.\n",pHba->name);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
} while (m == EMPTY_QUEUE); } while (m == EMPTY_QUEUE);
// Flush the offset // Flush the offset
adpt_send_nop(pHba, m); adpt_send_nop(pHba, m);
...@@ -1917,11 +1913,8 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd, ...@@ -1917,11 +1913,8 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,
return -ENXIO; return -ENXIO;
} }
while((volatile u32) pHba->state & DPTI_STATE_RESET ) { while((volatile u32) pHba->state & DPTI_STATE_RESET )
set_task_state(current,TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(2);
schedule_timeout(2);
}
switch (cmd) { switch (cmd) {
// TODO: handle 3 cases // TODO: handle 3 cases
...@@ -2635,8 +2628,7 @@ static s32 adpt_send_nop(adpt_hba*pHba,u32 m) ...@@ -2635,8 +2628,7 @@ static s32 adpt_send_nop(adpt_hba*pHba,u32 m)
printk(KERN_ERR "%s: Timeout waiting for message frame!\n",pHba->name); printk(KERN_ERR "%s: Timeout waiting for message frame!\n",pHba->name);
return 2; return 2;
} }
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
} }
msg = (u32 __iomem *)(pHba->msg_addr_virt + m); msg = (u32 __iomem *)(pHba->msg_addr_virt + m);
writel( THREE_WORD_MSG_SIZE | SGL_OFFSET_0,&msg[0]); writel( THREE_WORD_MSG_SIZE | SGL_OFFSET_0,&msg[0]);
...@@ -2670,8 +2662,7 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba) ...@@ -2670,8 +2662,7 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba)
printk(KERN_WARNING"%s: Timeout waiting for message frame\n",pHba->name); printk(KERN_WARNING"%s: Timeout waiting for message frame\n",pHba->name);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
} while(m == EMPTY_QUEUE); } while(m == EMPTY_QUEUE);
msg=(u32 __iomem *)(pHba->msg_addr_virt+m); msg=(u32 __iomem *)(pHba->msg_addr_virt+m);
...@@ -2709,8 +2700,7 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba) ...@@ -2709,8 +2700,7 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba)
printk(KERN_WARNING"%s: Timeout Initializing\n",pHba->name); printk(KERN_WARNING"%s: Timeout Initializing\n",pHba->name);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
} while (1); } while (1);
// If the command was successful, fill the fifo with our reply // If the command was successful, fill the fifo with our reply
...@@ -2788,8 +2778,7 @@ static s32 adpt_i2o_status_get(adpt_hba* pHba) ...@@ -2788,8 +2778,7 @@ static s32 adpt_i2o_status_get(adpt_hba* pHba)
pHba->name); pHba->name);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
} while(m==EMPTY_QUEUE); } while(m==EMPTY_QUEUE);
...@@ -2816,8 +2805,7 @@ static s32 adpt_i2o_status_get(adpt_hba* pHba) ...@@ -2816,8 +2805,7 @@ static s32 adpt_i2o_status_get(adpt_hba* pHba)
return -ETIMEDOUT; return -ETIMEDOUT;
} }
rmb(); rmb();
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(1);
schedule_timeout(1);
} }
// Set up our number of outbound and inbound messages // Set up our number of outbound and inbound messages
......
...@@ -825,8 +825,7 @@ __lpfc_abort_handler(struct scsi_cmnd *cmnd) ...@@ -825,8 +825,7 @@ __lpfc_abort_handler(struct scsi_cmnd *cmnd)
while (lpfc_cmd->pCmd == cmnd) while (lpfc_cmd->pCmd == cmnd)
{ {
spin_unlock_irq(phba->host->host_lock); spin_unlock_irq(phba->host->host_lock);
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(LPFC_ABORT_WAIT*HZ);
schedule_timeout(LPFC_ABORT_WAIT*HZ);
spin_lock_irq(phba->host->host_lock); spin_lock_irq(phba->host->host_lock);
if (++loop_count if (++loop_count
> (2 * phba->cfg_nodev_tmo)/LPFC_ABORT_WAIT) > (2 * phba->cfg_nodev_tmo)/LPFC_ABORT_WAIT)
...@@ -885,8 +884,7 @@ __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) ...@@ -885,8 +884,7 @@ __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
if (pnode->nlp_state != NLP_STE_MAPPED_NODE) { if (pnode->nlp_state != NLP_STE_MAPPED_NODE) {
spin_unlock_irq(phba->host->host_lock); spin_unlock_irq(phba->host->host_lock);
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(msecs_to_jiffies(500));
schedule_timeout( HZ/2);
spin_lock_irq(phba->host->host_lock); spin_lock_irq(phba->host->host_lock);
} }
if ((pnode) && (pnode->nlp_state == NLP_STE_MAPPED_NODE)) if ((pnode) && (pnode->nlp_state == NLP_STE_MAPPED_NODE))
...@@ -939,8 +937,7 @@ __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd) ...@@ -939,8 +937,7 @@ __lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
cmnd->device->id, cmnd->device->lun, cmnd->device->id, cmnd->device->lun,
LPFC_CTX_LUN))) { LPFC_CTX_LUN))) {
spin_unlock_irq(phba->host->host_lock); spin_unlock_irq(phba->host->host_lock);
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ);
schedule_timeout(LPFC_RESET_WAIT*HZ);
spin_lock_irq(phba->host->host_lock); spin_lock_irq(phba->host->host_lock);
if (++loopcnt if (++loopcnt
...@@ -1038,8 +1035,7 @@ __lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) ...@@ -1038,8 +1035,7 @@ __lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
&phba->sli.ring[phba->sli.fcp_ring], &phba->sli.ring[phba->sli.fcp_ring],
0, 0, LPFC_CTX_HOST))) { 0, 0, LPFC_CTX_HOST))) {
spin_unlock_irq(phba->host->host_lock); spin_unlock_irq(phba->host->host_lock);
set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ);
schedule_timeout(LPFC_RESET_WAIT*HZ);
spin_lock_irq(phba->host->host_lock); spin_lock_irq(phba->host->host_lock);
if (++loopcnt if (++loopcnt
......
...@@ -862,8 +862,7 @@ static int osst_recover_wait_frame(struct osst_tape * STp, struct scsi_request * ...@@ -862,8 +862,7 @@ static int osst_recover_wait_frame(struct osst_tape * STp, struct scsi_request *
retval = osst_write_error_recovery(STp, aSRpnt, 0); retval = osst_write_error_recovery(STp, aSRpnt, 0);
break; break;
} }
set_current_state(TASK_INTERRUPTIBLE); schedule_timeout_interruptible(HZ / OSST_POLL_PER_SEC);
schedule_timeout (HZ / OSST_POLL_PER_SEC);
STp->buffer->b_data = mybuf; STp->buffer->buffer_size = 24; STp->buffer->b_data = mybuf; STp->buffer->buffer_size = 24;
memset(cmd, 0, MAX_COMMAND_SIZE); memset(cmd, 0, MAX_COMMAND_SIZE);
...@@ -1558,8 +1557,7 @@ static int osst_reposition_and_retry(struct osst_tape * STp, struct scsi_request ...@@ -1558,8 +1557,7 @@ static int osst_reposition_and_retry(struct osst_tape * STp, struct scsi_request
osst_set_frame_position(STp, aSRpnt, frame + skip, 1); osst_set_frame_position(STp, aSRpnt, frame + skip, 1);
flag = 0; flag = 0;
attempts--; attempts--;
set_current_state(TASK_INTERRUPTIBLE); schedule_timeout_interruptible(msecs_to_jiffies(100));
schedule_timeout(HZ / 10);
} }
if (osst_get_frame_position(STp, aSRpnt) < 0) { /* additional write error */ if (osst_get_frame_position(STp, aSRpnt) < 0) { /* additional write error */
#if DEBUG #if DEBUG
...@@ -1620,8 +1618,7 @@ static int osst_reposition_and_retry(struct osst_tape * STp, struct scsi_request ...@@ -1620,8 +1618,7 @@ static int osst_reposition_and_retry(struct osst_tape * STp, struct scsi_request
debugging = 0; debugging = 0;
} }
#endif #endif
set_current_state(TASK_INTERRUPTIBLE); schedule_timeout_interruptible(msecs_to_jiffies(100));
schedule_timeout(HZ / 10);
} }
printk(KERN_ERR "%s:E: Failed to find valid tape media\n", name); printk(KERN_ERR "%s:E: Failed to find valid tape media\n", name);
#if DEBUG #if DEBUG
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment