Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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: Nishanth Aravamudan <nacc@us.ibm.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Nishanth Aravamudan and committed by
Linus Torvalds
a9a3047d 6521018d

+25 -53
+1 -4
drivers/scsi/NCR5380.c
··· 606 606 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA | ICR_ASSERT_SEL); 607 607 608 608 while (probe_irq == SCSI_IRQ_NONE && time_before(jiffies, timeout)) 609 - { 610 - set_current_state(TASK_UNINTERRUPTIBLE); 611 - schedule_timeout(1); 612 - } 609 + schedule_timeout_uninterruptible(1); 613 610 614 611 NCR5380_write(SELECT_ENABLE_REG, 0); 615 612 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
+2 -4
drivers/scsi/aacraid/rkt.c
··· 183 183 /* 184 184 * Yield the processor in case we are slow 185 185 */ 186 - set_current_state(TASK_UNINTERRUPTIBLE); 187 - schedule_timeout(1); 186 + schedule_timeout_uninterruptible(1); 188 187 } 189 188 if (ok != 1) { 190 189 /* ··· 451 452 dev->name, instance, status); 452 453 goto error_iounmap; 453 454 } 454 - set_current_state(TASK_UNINTERRUPTIBLE); 455 - schedule_timeout(1); 455 + schedule_timeout_uninterruptible(1); 456 456 } 457 457 if (request_irq(dev->scsi_host_ptr->irq, aac_rkt_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev)<0) 458 458 {
+2 -4
drivers/scsi/aacraid/rx.c
··· 183 183 /* 184 184 * Yield the processor in case we are slow 185 185 */ 186 - set_current_state(TASK_UNINTERRUPTIBLE); 187 - schedule_timeout(1); 186 + schedule_timeout_uninterruptible(1); 188 187 } 189 188 if (ok != 1) { 190 189 /* ··· 451 452 dev->name, instance, status); 452 453 goto error_iounmap; 453 454 } 454 - set_current_state(TASK_UNINTERRUPTIBLE); 455 - schedule_timeout(1); 455 + schedule_timeout_uninterruptible(1); 456 456 } 457 457 if (request_irq(dev->scsi_host_ptr->irq, aac_rx_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev)<0) 458 458 {
+2 -4
drivers/scsi/aacraid/sa.c
··· 189 189 ok = 1; 190 190 break; 191 191 } 192 - set_current_state(TASK_UNINTERRUPTIBLE); 193 - schedule_timeout(1); 192 + schedule_timeout_uninterruptible(1); 194 193 } 195 194 196 195 if (ok != 1) ··· 324 325 name, instance, status); 325 326 goto error_iounmap; 326 327 } 327 - set_current_state(TASK_UNINTERRUPTIBLE); 328 - schedule_timeout(1); 328 + schedule_timeout_uninterruptible(1); 329 329 } 330 330 331 331 if (request_irq(dev->scsi_host_ptr->irq, aac_sa_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev ) < 0) {
+11 -23
drivers/scsi/dpt_i2o.c
··· 1218 1218 printk(KERN_WARNING"dpti%d: Timeout waiting for message frame!\n", pHba->unit); 1219 1219 return -ETIMEDOUT; 1220 1220 } 1221 - set_current_state(TASK_UNINTERRUPTIBLE); 1222 - schedule_timeout(1); 1221 + schedule_timeout_uninterruptible(1); 1223 1222 } while(m == EMPTY_QUEUE); 1224 1223 1225 1224 msg = pHba->msg_addr_virt + m; ··· 1293 1294 printk(KERN_WARNING"Timeout waiting for message!\n"); 1294 1295 return -ETIMEDOUT; 1295 1296 } 1296 - set_current_state(TASK_UNINTERRUPTIBLE); 1297 - schedule_timeout(1); 1297 + schedule_timeout_uninterruptible(1); 1298 1298 } while (m == EMPTY_QUEUE); 1299 1299 1300 1300 status = (u8*)kmalloc(4, GFP_KERNEL|ADDR32); ··· 1325 1327 return -ETIMEDOUT; 1326 1328 } 1327 1329 rmb(); 1328 - set_current_state(TASK_UNINTERRUPTIBLE); 1329 - schedule_timeout(1); 1330 + schedule_timeout_uninterruptible(1); 1330 1331 } 1331 1332 1332 1333 if(*status == 0x01 /*I2O_EXEC_IOP_RESET_IN_PROGRESS*/) { ··· 1342 1345 printk(KERN_ERR "%s:Timeout waiting for IOP Reset.\n",pHba->name); 1343 1346 return -ETIMEDOUT; 1344 1347 } 1345 - set_current_state(TASK_UNINTERRUPTIBLE); 1346 - schedule_timeout(1); 1348 + schedule_timeout_uninterruptible(1); 1347 1349 } while (m == EMPTY_QUEUE); 1348 1350 // Flush the offset 1349 1351 adpt_send_nop(pHba, m); ··· 1913 1917 return -ENXIO; 1914 1918 } 1915 1919 1916 - while((volatile u32) pHba->state & DPTI_STATE_RESET ) { 1917 - set_task_state(current,TASK_UNINTERRUPTIBLE); 1918 - schedule_timeout(2); 1919 - 1920 - } 1920 + while((volatile u32) pHba->state & DPTI_STATE_RESET ) 1921 + schedule_timeout_uninterruptible(2); 1921 1922 1922 1923 switch (cmd) { 1923 1924 // TODO: handle 3 cases ··· 2628 2635 printk(KERN_ERR "%s: Timeout waiting for message frame!\n",pHba->name); 2629 2636 return 2; 2630 2637 } 2631 - set_current_state(TASK_UNINTERRUPTIBLE); 2632 - schedule_timeout(1); 2638 + schedule_timeout_uninterruptible(1); 2633 2639 } 2634 2640 msg = (u32 __iomem *)(pHba->msg_addr_virt + m); 2635 2641 writel( THREE_WORD_MSG_SIZE | SGL_OFFSET_0,&msg[0]); ··· 2662 2670 printk(KERN_WARNING"%s: Timeout waiting for message frame\n",pHba->name); 2663 2671 return -ETIMEDOUT; 2664 2672 } 2665 - set_current_state(TASK_UNINTERRUPTIBLE); 2666 - schedule_timeout(1); 2673 + schedule_timeout_uninterruptible(1); 2667 2674 } while(m == EMPTY_QUEUE); 2668 2675 2669 2676 msg=(u32 __iomem *)(pHba->msg_addr_virt+m); ··· 2700 2709 printk(KERN_WARNING"%s: Timeout Initializing\n",pHba->name); 2701 2710 return -ETIMEDOUT; 2702 2711 } 2703 - set_current_state(TASK_UNINTERRUPTIBLE); 2704 - schedule_timeout(1); 2712 + schedule_timeout_uninterruptible(1); 2705 2713 } while (1); 2706 2714 2707 2715 // If the command was successful, fill the fifo with our reply ··· 2778 2788 pHba->name); 2779 2789 return -ETIMEDOUT; 2780 2790 } 2781 - set_current_state(TASK_UNINTERRUPTIBLE); 2782 - schedule_timeout(1); 2791 + schedule_timeout_uninterruptible(1); 2783 2792 } while(m==EMPTY_QUEUE); 2784 2793 2785 2794 ··· 2805 2816 return -ETIMEDOUT; 2806 2817 } 2807 2818 rmb(); 2808 - set_current_state(TASK_UNINTERRUPTIBLE); 2809 - schedule_timeout(1); 2819 + schedule_timeout_uninterruptible(1); 2810 2820 } 2811 2821 2812 2822 // Set up our number of outbound and inbound messages
+4 -8
drivers/scsi/lpfc/lpfc_scsi.c
··· 825 825 while (lpfc_cmd->pCmd == cmnd) 826 826 { 827 827 spin_unlock_irq(phba->host->host_lock); 828 - set_current_state(TASK_UNINTERRUPTIBLE); 829 - schedule_timeout(LPFC_ABORT_WAIT*HZ); 828 + schedule_timeout_uninterruptible(LPFC_ABORT_WAIT*HZ); 830 829 spin_lock_irq(phba->host->host_lock); 831 830 if (++loop_count 832 831 > (2 * phba->cfg_nodev_tmo)/LPFC_ABORT_WAIT) ··· 884 885 885 886 if (pnode->nlp_state != NLP_STE_MAPPED_NODE) { 886 887 spin_unlock_irq(phba->host->host_lock); 887 - set_current_state(TASK_UNINTERRUPTIBLE); 888 - schedule_timeout( HZ/2); 888 + schedule_timeout_uninterruptible(msecs_to_jiffies(500)); 889 889 spin_lock_irq(phba->host->host_lock); 890 890 } 891 891 if ((pnode) && (pnode->nlp_state == NLP_STE_MAPPED_NODE)) ··· 937 939 cmnd->device->id, cmnd->device->lun, 938 940 LPFC_CTX_LUN))) { 939 941 spin_unlock_irq(phba->host->host_lock); 940 - set_current_state(TASK_UNINTERRUPTIBLE); 941 - schedule_timeout(LPFC_RESET_WAIT*HZ); 942 + schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); 942 943 spin_lock_irq(phba->host->host_lock); 943 944 944 945 if (++loopcnt ··· 1035 1038 &phba->sli.ring[phba->sli.fcp_ring], 1036 1039 0, 0, LPFC_CTX_HOST))) { 1037 1040 spin_unlock_irq(phba->host->host_lock); 1038 - set_current_state(TASK_UNINTERRUPTIBLE); 1039 - schedule_timeout(LPFC_RESET_WAIT*HZ); 1041 + schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ); 1040 1042 spin_lock_irq(phba->host->host_lock); 1041 1043 1042 1044 if (++loopcnt
+3 -6
drivers/scsi/osst.c
··· 862 862 retval = osst_write_error_recovery(STp, aSRpnt, 0); 863 863 break; 864 864 } 865 - set_current_state(TASK_INTERRUPTIBLE); 866 - schedule_timeout (HZ / OSST_POLL_PER_SEC); 865 + schedule_timeout_interruptible(HZ / OSST_POLL_PER_SEC); 867 866 868 867 STp->buffer->b_data = mybuf; STp->buffer->buffer_size = 24; 869 868 memset(cmd, 0, MAX_COMMAND_SIZE); ··· 1557 1558 osst_set_frame_position(STp, aSRpnt, frame + skip, 1); 1558 1559 flag = 0; 1559 1560 attempts--; 1560 - set_current_state(TASK_INTERRUPTIBLE); 1561 - schedule_timeout(HZ / 10); 1561 + schedule_timeout_interruptible(msecs_to_jiffies(100)); 1562 1562 } 1563 1563 if (osst_get_frame_position(STp, aSRpnt) < 0) { /* additional write error */ 1564 1564 #if DEBUG ··· 1618 1620 debugging = 0; 1619 1621 } 1620 1622 #endif 1621 - set_current_state(TASK_INTERRUPTIBLE); 1622 - schedule_timeout(HZ / 10); 1623 + schedule_timeout_interruptible(msecs_to_jiffies(100)); 1623 1624 } 1624 1625 printk(KERN_ERR "%s:E: Failed to find valid tape media\n", name); 1625 1626 #if DEBUG