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

[SCSI] qla1280: driver clean up

Remove some unneeded, inactive and unused code, make some trivial
corrections to comments and a printk, and return a proper status
in qla1280_queuecommand. No fundamental logic changes are made.

Signed-off-by: Michael Reed <mdr@sgi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

authored by

Michael Reed and committed by
James Bottomley
fd65e5e9 14faf12f

+10 -89
+10 -89
drivers/scsi/qla1280.c
··· 435 435 uint8_t, uint16_t *); 436 436 static int qla1280_bus_reset(struct scsi_qla_host *, int); 437 437 static int qla1280_device_reset(struct scsi_qla_host *, int, int); 438 - static int qla1280_abort_device(struct scsi_qla_host *, int, int, int); 439 438 static int qla1280_abort_command(struct scsi_qla_host *, struct srb *, int); 440 439 static int qla1280_abort_isp(struct scsi_qla_host *); 441 440 #ifdef QLA_64BIT_PTR ··· 697 698 } 698 699 699 700 /************************************************************************** 700 - * qla1200_queuecommand 701 + * qla1280_queuecommand 701 702 * Queue a command to the controller. 702 703 * 703 704 * Note: ··· 712 713 { 713 714 struct Scsi_Host *host = cmd->device->host; 714 715 struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata; 715 - struct srb *sp = (struct srb *)&cmd->SCp; 716 + struct srb *sp = (struct srb *)CMD_SP(cmd); 716 717 int status; 717 718 718 719 cmd->scsi_done = fn; ··· 737 738 738 739 enum action { 739 740 ABORT_COMMAND, 740 - ABORT_DEVICE, 741 741 DEVICE_RESET, 742 742 BUS_RESET, 743 743 ADAPTER_RESET, 744 - FAIL 745 744 }; 746 745 747 746 /* timer action for error action processor */ ··· 765 768 } 766 769 767 770 /************************************************************************** 768 - * qla1200_error_action 771 + * qla1280_error_action 769 772 * The function will attempt to perform a specified error action and 770 773 * wait for the results (or time out). 771 774 * ··· 795 798 DECLARE_COMPLETION_ONSTACK(wait); 796 799 struct timer_list timer; 797 800 801 + ENTER("qla1280_error_action"); 802 + 798 803 ha = (struct scsi_qla_host *)(CMD_HOST(cmd)->hostdata); 799 804 800 805 dprintk(4, "error_action %i, istatus 0x%04x\n", action, ··· 806 807 RD_REG_WORD(&ha->iobase->host_cmd), 807 808 RD_REG_WORD(&ha->iobase->ictrl), jiffies); 808 809 809 - ENTER("qla1280_error_action"); 810 810 if (qla1280_verbose) 811 811 printk(KERN_INFO "scsi(%li): Resetting Cmnd=0x%p, " 812 812 "Handle=0x%p, action=0x%x\n", 813 813 ha->host_no, cmd, CMD_HANDLE(cmd), action); 814 814 815 - if (cmd == NULL) { 816 - printk(KERN_WARNING "(scsi?:?:?:?) Reset called with NULL " 817 - "si_Cmnd pointer, failing.\n"); 818 - LEAVE("qla1280_error_action"); 819 - return FAILED; 820 - } 821 - 822 - ha = (struct scsi_qla_host *)cmd->device->host->hostdata; 823 815 sp = (struct srb *)CMD_SP(cmd); 824 816 handle = CMD_HANDLE(cmd); 825 817 ··· 847 857 * mean the actual success or fail of the action */ 848 858 result = FAILED; 849 859 switch (action) { 850 - case FAIL: 851 - break; 852 - 853 860 case ABORT_COMMAND: 854 861 if ((sp->flags & SRB_ABORT_PENDING)) { 855 862 printk(KERN_WARNING ··· 878 891 } 879 892 } 880 893 } 881 - break; 882 - 883 - case ABORT_DEVICE: 884 - if (qla1280_verbose) 885 - printk(KERN_INFO 886 - "scsi(%ld:%d:%d:%d): Queueing abort device " 887 - "command.\n", ha->host_no, bus, target, lun); 888 - if (qla1280_abort_device(ha, bus, target, lun) == 0) 889 - result = SUCCESS; 890 894 break; 891 895 892 896 case DEVICE_RESET: ··· 1263 1285 case DID_ABORT: 1264 1286 sp->flags &= ~SRB_ABORT_PENDING; 1265 1287 sp->flags |= SRB_ABORTED; 1266 - if (sp->flags & SRB_TIMEOUT) 1267 - CMD_RESULT(sp->cmd) = DID_TIME_OUT << 16; 1268 1288 break; 1269 1289 default: 1270 1290 break; ··· 2393 2417 qla1280_mailbox_command(struct scsi_qla_host *ha, uint8_t mr, uint16_t *mb) 2394 2418 { 2395 2419 struct device_reg __iomem *reg = ha->iobase; 2396 - #if 0 2397 - LIST_HEAD(done_q); 2398 - #endif 2399 2420 int status = 0; 2400 2421 int cnt; 2401 2422 uint16_t *optr, *iptr; ··· 2466 2493 mr = MAILBOX_REGISTER_COUNT; 2467 2494 memcpy(optr, iptr, MAILBOX_REGISTER_COUNT * sizeof(uint16_t)); 2468 2495 2469 - #if 0 2470 - /* Go check for any response interrupts pending. */ 2471 - qla1280_isr(ha, &done_q); 2472 - #endif 2473 - 2474 2496 if (ha->flags.reset_marker) 2475 2497 qla1280_rst_aen(ha); 2476 - 2477 - #if 0 2478 - if (!list_empty(&done_q)) 2479 - qla1280_done(ha, &done_q); 2480 - #endif 2481 2498 2482 2499 if (status) 2483 2500 dprintk(2, "qla1280_mailbox_command: **** FAILED, mailbox0 = " ··· 2600 2637 dprintk(2, "qla1280_device_reset: **** FAILED ****\n"); 2601 2638 2602 2639 LEAVE("qla1280_device_reset"); 2603 - return status; 2604 - } 2605 - 2606 - /* 2607 - * qla1280_abort_device 2608 - * Issue an abort message to the device 2609 - * 2610 - * Input: 2611 - * ha = adapter block pointer. 2612 - * bus = SCSI BUS. 2613 - * target = SCSI ID. 2614 - * lun = SCSI LUN. 2615 - * 2616 - * Returns: 2617 - * 0 = success 2618 - */ 2619 - static int 2620 - qla1280_abort_device(struct scsi_qla_host *ha, int bus, int target, int lun) 2621 - { 2622 - uint16_t mb[MAILBOX_REGISTER_COUNT]; 2623 - int status; 2624 - 2625 - ENTER("qla1280_abort_device"); 2626 - 2627 - mb[0] = MBC_ABORT_DEVICE; 2628 - mb[1] = (bus ? target | BIT_7 : target) << 8 | lun; 2629 - status = qla1280_mailbox_command(ha, BIT_1 | BIT_0, &mb[0]); 2630 - 2631 - /* Issue marker command. */ 2632 - qla1280_marker(ha, bus, target, lun, MK_SYNC_ID_LUN); 2633 - 2634 - if (status) 2635 - dprintk(2, "qla1280_abort_device: **** FAILED ****\n"); 2636 - 2637 - LEAVE("qla1280_abort_device"); 2638 2640 return status; 2639 2641 } 2640 2642 ··· 2761 2833 2762 2834 /* If room for request in request ring. */ 2763 2835 if ((req_cnt + 2) >= ha->req_q_cnt) { 2764 - status = 1; 2836 + status = SCSI_MLQUEUE_HOST_BUSY; 2765 2837 dprintk(2, "qla1280_start_scsi: in-ptr=0x%x req_q_cnt=" 2766 2838 "0x%xreq_cnt=0x%x", ha->req_ring_index, ha->req_q_cnt, 2767 2839 req_cnt); ··· 2773 2845 ha->outstanding_cmds[cnt] != NULL; cnt++); 2774 2846 2775 2847 if (cnt >= MAX_OUTSTANDING_COMMANDS) { 2776 - status = 1; 2848 + status = SCSI_MLQUEUE_HOST_BUSY; 2777 2849 dprintk(2, "qla1280_start_scsi: NO ROOM IN " 2778 2850 "OUTSTANDING ARRAY, req_q_cnt=0x%x", ha->req_q_cnt); 2779 2851 goto out; ··· 3036 3108 ha->req_q_cnt, seg_cnt); 3037 3109 /* If room for request in request ring. */ 3038 3110 if ((req_cnt + 2) >= ha->req_q_cnt) { 3039 - status = 1; 3111 + status = SCSI_MLQUEUE_HOST_BUSY; 3040 3112 dprintk(2, "qla1280_32bit_start_scsi: in-ptr=0x%x, " 3041 3113 "req_q_cnt=0x%x, req_cnt=0x%x", ha->req_ring_index, 3042 3114 ha->req_q_cnt, req_cnt); ··· 3048 3120 (ha->outstanding_cmds[cnt] != 0); cnt++) ; 3049 3121 3050 3122 if (cnt >= MAX_OUTSTANDING_COMMANDS) { 3051 - status = 1; 3123 + status = SCSI_MLQUEUE_HOST_BUSY; 3052 3124 dprintk(2, "qla1280_32bit_start_scsi: NO ROOM IN OUTSTANDING " 3053 3125 "ARRAY, req_q_cnt=0x%x\n", ha->req_q_cnt); 3054 3126 goto out; ··· 3423 3495 * If we get here we have a real problem! 3424 3496 */ 3425 3497 printk(KERN_WARNING 3426 - "qla1280: ISP invalid handle"); 3498 + "qla1280: ISP invalid handle\n"); 3427 3499 } 3428 3500 } 3429 3501 break; ··· 3883 3955 3884 3956 if (scsi_control == SCSI_PHASE_INVALID) { 3885 3957 ha->bus_settings[bus].scsi_bus_dead = 1; 3886 - #if 0 3887 - CMD_RESULT(cp) = DID_NO_CONNECT << 16; 3888 - CMD_HANDLE(cp) = INVALID_HANDLE; 3889 - /* ha->actthreads--; */ 3890 - 3891 - (*(cp)->scsi_done)(cp); 3892 - #endif 3893 3958 return 1; /* bus is dead */ 3894 3959 } else { 3895 3960 ha->bus_settings[bus].scsi_bus_dead = 0;