diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-15 11:19:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-15 11:19:33 -0400 |
commit | df3d80f5a5c74168be42788364d13cf6c83c7b9c (patch) | |
tree | 892a964c2fd28d028f2fb7471e8543d3f4006a58 /drivers/scsi/gdth_proc.c | |
parent | 3d06f7a5f74a813cee817c4b30b5e6f0398da0be (diff) | |
parent | c8e91b0a8fc8493e3bf3efcb3c8f866e9453cf1c (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (207 commits)
[SCSI] gdth: fix CONFIG_ISA build failure
[SCSI] esp_scsi: remove __dev{init,exit}
[SCSI] gdth: !use_sg cleanup and use of scsi accessors
[SCSI] gdth: Move members from SCp to gdth_cmndinfo, stage 2
[SCSI] gdth: Setup proper per-command private data
[SCSI] gdth: Remove gdth_ctr_tab[]
[SCSI] gdth: switch to modern scsi host registration
[SCSI] gdth: gdth_interrupt() gdth_get_status() & gdth_wait() fixes
[SCSI] gdth: clean up host private data
[SCSI] gdth: Remove virt hosts
[SCSI] gdth: Reorder scsi_host_template intitializers
[SCSI] gdth: kill gdth_{read,write}[bwl] wrappers
[SCSI] gdth: Remove 2.4.x support, in-kernel changelog
[SCSI] gdth: split out pci probing
[SCSI] gdth: split out eisa probing
[SCSI] gdth: split out isa probing
gdth: Make one abuse of scsi_cmnd less obvious
[SCSI] NCR5380: Use scsi_eh API for REQUEST_SENSE invocation
[SCSI] usb storage: use scsi_eh API in REQUEST_SENSE execution
[SCSI] scsi_error: Refactoring scsi_error to facilitate in synchronous REQUEST_SENSE
...
Diffstat (limited to 'drivers/scsi/gdth_proc.c')
-rw-r--r-- | drivers/scsi/gdth_proc.c | 133 |
1 files changed, 43 insertions, 90 deletions
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c index 32982eb75c84..de5773443c62 100644 --- a/drivers/scsi/gdth_proc.c +++ b/drivers/scsi/gdth_proc.c | |||
@@ -4,62 +4,32 @@ | |||
4 | 4 | ||
5 | #include <linux/completion.h> | 5 | #include <linux/completion.h> |
6 | 6 | ||
7 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) | ||
8 | int gdth_proc_info(struct Scsi_Host *host, char *buffer,char **start,off_t offset,int length, | 7 | int gdth_proc_info(struct Scsi_Host *host, char *buffer,char **start,off_t offset,int length, |
9 | int inout) | 8 | int inout) |
10 | { | 9 | { |
11 | int hanum,busnum; | 10 | gdth_ha_str *ha = shost_priv(host); |
12 | 11 | ||
13 | TRACE2(("gdth_proc_info() length %d offs %d inout %d\n", | 12 | TRACE2(("gdth_proc_info() length %d offs %d inout %d\n", |
14 | length,(int)offset,inout)); | 13 | length,(int)offset,inout)); |
15 | 14 | ||
16 | hanum = NUMDATA(host)->hanum; | ||
17 | busnum= NUMDATA(host)->busnum; | ||
18 | |||
19 | if (inout) | ||
20 | return(gdth_set_info(buffer,length,host,hanum,busnum)); | ||
21 | else | ||
22 | return(gdth_get_info(buffer,start,offset,length,host,hanum,busnum)); | ||
23 | } | ||
24 | #else | ||
25 | int gdth_proc_info(char *buffer,char **start,off_t offset,int length,int hostno, | ||
26 | int inout) | ||
27 | { | ||
28 | int hanum,busnum,i; | ||
29 | |||
30 | TRACE2(("gdth_proc_info() length %d offs %d inout %d\n", | ||
31 | length,(int)offset,inout)); | ||
32 | |||
33 | for (i = 0; i < gdth_ctr_vcount; ++i) { | ||
34 | if (gdth_ctr_vtab[i]->host_no == hostno) | ||
35 | break; | ||
36 | } | ||
37 | if (i == gdth_ctr_vcount) | ||
38 | return(-EINVAL); | ||
39 | |||
40 | hanum = NUMDATA(gdth_ctr_vtab[i])->hanum; | ||
41 | busnum= NUMDATA(gdth_ctr_vtab[i])->busnum; | ||
42 | |||
43 | if (inout) | 15 | if (inout) |
44 | return(gdth_set_info(buffer,length,gdth_ctr_vtab[i],hanum,busnum)); | 16 | return(gdth_set_info(buffer,length,host,ha)); |
45 | else | 17 | else |
46 | return(gdth_get_info(buffer,start,offset,length, | 18 | return(gdth_get_info(buffer,start,offset,length,host,ha)); |
47 | gdth_ctr_vtab[i],hanum,busnum)); | ||
48 | } | 19 | } |
49 | #endif | ||
50 | 20 | ||
51 | static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host, | 21 | static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host, |
52 | int hanum,int busnum) | 22 | gdth_ha_str *ha) |
53 | { | 23 | { |
54 | int ret_val = -EINVAL; | 24 | int ret_val = -EINVAL; |
55 | 25 | ||
56 | TRACE2(("gdth_set_info() ha %d bus %d\n",hanum,busnum)); | 26 | TRACE2(("gdth_set_info() ha %d\n",ha->hanum,)); |
57 | 27 | ||
58 | if (length >= 4) { | 28 | if (length >= 4) { |
59 | if (strncmp(buffer,"gdth",4) == 0) { | 29 | if (strncmp(buffer,"gdth",4) == 0) { |
60 | buffer += 5; | 30 | buffer += 5; |
61 | length -= 5; | 31 | length -= 5; |
62 | ret_val = gdth_set_asc_info(host, buffer, length, hanum); | 32 | ret_val = gdth_set_asc_info(host, buffer, length, ha); |
63 | } | 33 | } |
64 | } | 34 | } |
65 | 35 | ||
@@ -67,11 +37,10 @@ static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host, | |||
67 | } | 37 | } |
68 | 38 | ||
69 | static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | 39 | static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, |
70 | int length,int hanum) | 40 | int length, gdth_ha_str *ha) |
71 | { | 41 | { |
72 | int orig_length, drive, wb_mode; | 42 | int orig_length, drive, wb_mode; |
73 | int i, found; | 43 | int i, found; |
74 | gdth_ha_str *ha; | ||
75 | gdth_cmd_str gdtcmd; | 44 | gdth_cmd_str gdtcmd; |
76 | gdth_cpar_str *pcpar; | 45 | gdth_cpar_str *pcpar; |
77 | ulong64 paddr; | 46 | ulong64 paddr; |
@@ -80,8 +49,7 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | |||
80 | memset(cmnd, 0xff, 12); | 49 | memset(cmnd, 0xff, 12); |
81 | memset(&gdtcmd, 0, sizeof(gdth_cmd_str)); | 50 | memset(&gdtcmd, 0, sizeof(gdth_cmd_str)); |
82 | 51 | ||
83 | TRACE2(("gdth_set_asc_info() ha %d\n",hanum)); | 52 | TRACE2(("gdth_set_asc_info() ha %d\n",ha->hanum)); |
84 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
85 | orig_length = length + 5; | 53 | orig_length = length + 5; |
86 | drive = -1; | 54 | drive = -1; |
87 | wb_mode = 0; | 55 | wb_mode = 0; |
@@ -157,7 +125,7 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | |||
157 | } | 125 | } |
158 | 126 | ||
159 | if (wb_mode) { | 127 | if (wb_mode) { |
160 | if (!gdth_ioctl_alloc(hanum, sizeof(gdth_cpar_str), TRUE, &paddr)) | 128 | if (!gdth_ioctl_alloc(ha, sizeof(gdth_cpar_str), TRUE, &paddr)) |
161 | return(-EBUSY); | 129 | return(-EBUSY); |
162 | pcpar = (gdth_cpar_str *)ha->pscratch; | 130 | pcpar = (gdth_cpar_str *)ha->pscratch; |
163 | memcpy( pcpar, &ha->cpar, sizeof(gdth_cpar_str) ); | 131 | memcpy( pcpar, &ha->cpar, sizeof(gdth_cpar_str) ); |
@@ -171,7 +139,7 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | |||
171 | 139 | ||
172 | gdth_execute(host, &gdtcmd, cmnd, 30, NULL); | 140 | gdth_execute(host, &gdtcmd, cmnd, 30, NULL); |
173 | 141 | ||
174 | gdth_ioctl_free(hanum, GDTH_SCRATCH, ha->pscratch, paddr); | 142 | gdth_ioctl_free(ha, GDTH_SCRATCH, ha->pscratch, paddr); |
175 | printk("Done.\n"); | 143 | printk("Done.\n"); |
176 | return(orig_length); | 144 | return(orig_length); |
177 | } | 145 | } |
@@ -181,11 +149,10 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | |||
181 | } | 149 | } |
182 | 150 | ||
183 | static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | 151 | static int gdth_get_info(char *buffer,char **start,off_t offset,int length, |
184 | struct Scsi_Host *host,int hanum,int busnum) | 152 | struct Scsi_Host *host, gdth_ha_str *ha) |
185 | { | 153 | { |
186 | int size = 0,len = 0; | 154 | int size = 0,len = 0; |
187 | off_t begin = 0,pos = 0; | 155 | off_t begin = 0,pos = 0; |
188 | gdth_ha_str *ha; | ||
189 | int id, i, j, k, sec, flag; | 156 | int id, i, j, k, sec, flag; |
190 | int no_mdrv = 0, drv_no, is_mirr; | 157 | int no_mdrv = 0, drv_no, is_mirr; |
191 | ulong32 cnt; | 158 | ulong32 cnt; |
@@ -214,8 +181,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
214 | memset(cmnd, 0xff, 12); | 181 | memset(cmnd, 0xff, 12); |
215 | memset(gdtcmd, 0, sizeof(gdth_cmd_str)); | 182 | memset(gdtcmd, 0, sizeof(gdth_cmd_str)); |
216 | 183 | ||
217 | TRACE2(("gdth_get_info() ha %d bus %d\n",hanum,busnum)); | 184 | TRACE2(("gdth_get_info() ha %d\n",ha->hanum)); |
218 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
219 | 185 | ||
220 | 186 | ||
221 | /* request is i.e. "cat /proc/scsi/gdth/0" */ | 187 | /* request is i.e. "cat /proc/scsi/gdth/0" */ |
@@ -245,13 +211,10 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
245 | /* controller information */ | 211 | /* controller information */ |
246 | size = sprintf(buffer+len,"\nDisk Array Controller Information:\n"); | 212 | size = sprintf(buffer+len,"\nDisk Array Controller Information:\n"); |
247 | len += size; pos = begin + len; | 213 | len += size; pos = begin + len; |
248 | if (virt_ctr) | 214 | strcpy(hrec, ha->binfo.type_string); |
249 | sprintf(hrec, "%s (Bus %d)", ha->binfo.type_string, busnum); | ||
250 | else | ||
251 | strcpy(hrec, ha->binfo.type_string); | ||
252 | size = sprintf(buffer+len, | 215 | size = sprintf(buffer+len, |
253 | " Number: \t%d \tName: \t%s\n", | 216 | " Number: \t%d \tName: \t%s\n", |
254 | hanum, hrec); | 217 | ha->hanum, hrec); |
255 | len += size; pos = begin + len; | 218 | len += size; pos = begin + len; |
256 | 219 | ||
257 | if (ha->more_proc) | 220 | if (ha->more_proc) |
@@ -301,7 +264,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
301 | len += size; pos = begin + len; | 264 | len += size; pos = begin + len; |
302 | flag = FALSE; | 265 | flag = FALSE; |
303 | 266 | ||
304 | buf = gdth_ioctl_alloc(hanum, GDTH_SCRATCH, FALSE, &paddr); | 267 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); |
305 | if (!buf) | 268 | if (!buf) |
306 | goto stop_output; | 269 | goto stop_output; |
307 | for (i = 0; i < ha->bus_cnt; ++i) { | 270 | for (i = 0; i < ha->bus_cnt; ++i) { |
@@ -404,7 +367,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
404 | goto stop_output; | 367 | goto stop_output; |
405 | } | 368 | } |
406 | } | 369 | } |
407 | gdth_ioctl_free(hanum, GDTH_SCRATCH, buf, paddr); | 370 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); |
408 | 371 | ||
409 | if (!flag) { | 372 | if (!flag) { |
410 | size = sprintf(buffer+len, "\n --\n"); | 373 | size = sprintf(buffer+len, "\n --\n"); |
@@ -416,7 +379,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
416 | len += size; pos = begin + len; | 379 | len += size; pos = begin + len; |
417 | flag = FALSE; | 380 | flag = FALSE; |
418 | 381 | ||
419 | buf = gdth_ioctl_alloc(hanum, GDTH_SCRATCH, FALSE, &paddr); | 382 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); |
420 | if (!buf) | 383 | if (!buf) |
421 | goto stop_output; | 384 | goto stop_output; |
422 | for (i = 0; i < MAX_LDRIVES; ++i) { | 385 | for (i = 0; i < MAX_LDRIVES; ++i) { |
@@ -510,7 +473,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
510 | if (pos > offset + length) | 473 | if (pos > offset + length) |
511 | goto stop_output; | 474 | goto stop_output; |
512 | } | 475 | } |
513 | gdth_ioctl_free(hanum, GDTH_SCRATCH, buf, paddr); | 476 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); |
514 | 477 | ||
515 | if (!flag) { | 478 | if (!flag) { |
516 | size = sprintf(buffer+len, "\n --\n"); | 479 | size = sprintf(buffer+len, "\n --\n"); |
@@ -522,7 +485,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
522 | len += size; pos = begin + len; | 485 | len += size; pos = begin + len; |
523 | flag = FALSE; | 486 | flag = FALSE; |
524 | 487 | ||
525 | buf = gdth_ioctl_alloc(hanum, GDTH_SCRATCH, FALSE, &paddr); | 488 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); |
526 | if (!buf) | 489 | if (!buf) |
527 | goto stop_output; | 490 | goto stop_output; |
528 | for (i = 0; i < MAX_LDRIVES; ++i) { | 491 | for (i = 0; i < MAX_LDRIVES; ++i) { |
@@ -581,7 +544,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
581 | goto stop_output; | 544 | goto stop_output; |
582 | } | 545 | } |
583 | } | 546 | } |
584 | gdth_ioctl_free(hanum, GDTH_SCRATCH, buf, paddr); | 547 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); |
585 | 548 | ||
586 | if (!flag) { | 549 | if (!flag) { |
587 | size = sprintf(buffer+len, "\n --\n"); | 550 | size = sprintf(buffer+len, "\n --\n"); |
@@ -593,7 +556,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
593 | len += size; pos = begin + len; | 556 | len += size; pos = begin + len; |
594 | flag = FALSE; | 557 | flag = FALSE; |
595 | 558 | ||
596 | buf = gdth_ioctl_alloc(hanum, sizeof(gdth_hget_str), FALSE, &paddr); | 559 | buf = gdth_ioctl_alloc(ha, sizeof(gdth_hget_str), FALSE, &paddr); |
597 | if (!buf) | 560 | if (!buf) |
598 | goto stop_output; | 561 | goto stop_output; |
599 | for (i = 0; i < MAX_LDRIVES; ++i) { | 562 | for (i = 0; i < MAX_LDRIVES; ++i) { |
@@ -626,7 +589,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
626 | } | 589 | } |
627 | } | 590 | } |
628 | } | 591 | } |
629 | gdth_ioctl_free(hanum, sizeof(gdth_hget_str), buf, paddr); | 592 | gdth_ioctl_free(ha, sizeof(gdth_hget_str), buf, paddr); |
630 | 593 | ||
631 | for (i = 0; i < MAX_HDRIVES; ++i) { | 594 | for (i = 0; i < MAX_HDRIVES; ++i) { |
632 | if (!(ha->hdr[i].present)) | 595 | if (!(ha->hdr[i].present)) |
@@ -664,7 +627,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
664 | id = gdth_read_event(ha, id, estr); | 627 | id = gdth_read_event(ha, id, estr); |
665 | if (estr->event_source == 0) | 628 | if (estr->event_source == 0) |
666 | break; | 629 | break; |
667 | if (estr->event_data.eu.driver.ionode == hanum && | 630 | if (estr->event_data.eu.driver.ionode == ha->hanum && |
668 | estr->event_source == ES_ASYNC) { | 631 | estr->event_source == ES_ASYNC) { |
669 | gdth_log_event(&estr->event_data, hrec); | 632 | gdth_log_event(&estr->event_data, hrec); |
670 | do_gettimeofday(&tv); | 633 | do_gettimeofday(&tv); |
@@ -699,17 +662,15 @@ free_fail: | |||
699 | return rc; | 662 | return rc; |
700 | } | 663 | } |
701 | 664 | ||
702 | static char *gdth_ioctl_alloc(int hanum, int size, int scratch, | 665 | static char *gdth_ioctl_alloc(gdth_ha_str *ha, int size, int scratch, |
703 | ulong64 *paddr) | 666 | ulong64 *paddr) |
704 | { | 667 | { |
705 | gdth_ha_str *ha; | ||
706 | ulong flags; | 668 | ulong flags; |
707 | char *ret_val; | 669 | char *ret_val; |
708 | 670 | ||
709 | if (size == 0) | 671 | if (size == 0) |
710 | return NULL; | 672 | return NULL; |
711 | 673 | ||
712 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
713 | spin_lock_irqsave(&ha->smp_lock, flags); | 674 | spin_lock_irqsave(&ha->smp_lock, flags); |
714 | 675 | ||
715 | if (!ha->scratch_busy && size <= GDTH_SCRATCH) { | 676 | if (!ha->scratch_busy && size <= GDTH_SCRATCH) { |
@@ -729,12 +690,10 @@ static char *gdth_ioctl_alloc(int hanum, int size, int scratch, | |||
729 | return ret_val; | 690 | return ret_val; |
730 | } | 691 | } |
731 | 692 | ||
732 | static void gdth_ioctl_free(int hanum, int size, char *buf, ulong64 paddr) | 693 | static void gdth_ioctl_free(gdth_ha_str *ha, int size, char *buf, ulong64 paddr) |
733 | { | 694 | { |
734 | gdth_ha_str *ha; | ||
735 | ulong flags; | 695 | ulong flags; |
736 | 696 | ||
737 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
738 | spin_lock_irqsave(&ha->smp_lock, flags); | 697 | spin_lock_irqsave(&ha->smp_lock, flags); |
739 | 698 | ||
740 | if (buf == ha->pscratch) { | 699 | if (buf == ha->pscratch) { |
@@ -747,13 +706,11 @@ static void gdth_ioctl_free(int hanum, int size, char *buf, ulong64 paddr) | |||
747 | } | 706 | } |
748 | 707 | ||
749 | #ifdef GDTH_IOCTL_PROC | 708 | #ifdef GDTH_IOCTL_PROC |
750 | static int gdth_ioctl_check_bin(int hanum, ushort size) | 709 | static int gdth_ioctl_check_bin(gdth_ha_str *ha, ushort size) |
751 | { | 710 | { |
752 | gdth_ha_str *ha; | ||
753 | ulong flags; | 711 | ulong flags; |
754 | int ret_val; | 712 | int ret_val; |
755 | 713 | ||
756 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
757 | spin_lock_irqsave(&ha->smp_lock, flags); | 714 | spin_lock_irqsave(&ha->smp_lock, flags); |
758 | 715 | ||
759 | ret_val = FALSE; | 716 | ret_val = FALSE; |
@@ -766,27 +723,27 @@ static int gdth_ioctl_check_bin(int hanum, ushort size) | |||
766 | } | 723 | } |
767 | #endif | 724 | #endif |
768 | 725 | ||
769 | static void gdth_wait_completion(int hanum, int busnum, int id) | 726 | static void gdth_wait_completion(gdth_ha_str *ha, int busnum, int id) |
770 | { | 727 | { |
771 | gdth_ha_str *ha; | ||
772 | ulong flags; | 728 | ulong flags; |
773 | int i; | 729 | int i; |
774 | Scsi_Cmnd *scp; | 730 | Scsi_Cmnd *scp; |
731 | struct gdth_cmndinfo *cmndinfo; | ||
775 | unchar b, t; | 732 | unchar b, t; |
776 | 733 | ||
777 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
778 | spin_lock_irqsave(&ha->smp_lock, flags); | 734 | spin_lock_irqsave(&ha->smp_lock, flags); |
779 | 735 | ||
780 | for (i = 0; i < GDTH_MAXCMDS; ++i) { | 736 | for (i = 0; i < GDTH_MAXCMDS; ++i) { |
781 | scp = ha->cmd_tab[i].cmnd; | 737 | scp = ha->cmd_tab[i].cmnd; |
738 | cmndinfo = gdth_cmnd_priv(scp); | ||
782 | 739 | ||
783 | b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel; | 740 | b = scp->device->channel; |
784 | t = scp->device->id; | 741 | t = scp->device->id; |
785 | if (!SPECIAL_SCP(scp) && t == (unchar)id && | 742 | if (!SPECIAL_SCP(scp) && t == (unchar)id && |
786 | b == (unchar)busnum) { | 743 | b == (unchar)busnum) { |
787 | scp->SCp.have_data_in = 0; | 744 | cmndinfo->wait_for_completion = 0; |
788 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 745 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
789 | while (!scp->SCp.have_data_in) | 746 | while (!cmndinfo->wait_for_completion) |
790 | barrier(); | 747 | barrier(); |
791 | spin_lock_irqsave(&ha->smp_lock, flags); | 748 | spin_lock_irqsave(&ha->smp_lock, flags); |
792 | } | 749 | } |
@@ -794,55 +751,51 @@ static void gdth_wait_completion(int hanum, int busnum, int id) | |||
794 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 751 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
795 | } | 752 | } |
796 | 753 | ||
797 | static void gdth_stop_timeout(int hanum, int busnum, int id) | 754 | static void gdth_stop_timeout(gdth_ha_str *ha, int busnum, int id) |
798 | { | 755 | { |
799 | gdth_ha_str *ha; | ||
800 | ulong flags; | 756 | ulong flags; |
801 | Scsi_Cmnd *scp; | 757 | Scsi_Cmnd *scp; |
802 | unchar b, t; | 758 | unchar b, t; |
803 | 759 | ||
804 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
805 | spin_lock_irqsave(&ha->smp_lock, flags); | 760 | spin_lock_irqsave(&ha->smp_lock, flags); |
806 | 761 | ||
807 | for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { | 762 | for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { |
808 | if (scp->done != gdth_scsi_done) { | 763 | struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); |
809 | b = virt_ctr ? | 764 | if (!cmndinfo->internal_command) { |
810 | NUMDATA(scp->device->host)->busnum : scp->device->channel; | 765 | b = scp->device->channel; |
811 | t = scp->device->id; | 766 | t = scp->device->id; |
812 | if (t == (unchar)id && b == (unchar)busnum) { | 767 | if (t == (unchar)id && b == (unchar)busnum) { |
813 | TRACE2(("gdth_stop_timeout(): update_timeout()\n")); | 768 | TRACE2(("gdth_stop_timeout(): update_timeout()\n")); |
814 | scp->SCp.buffers_residual = gdth_update_timeout(hanum, scp, 0); | 769 | cmndinfo->timeout = gdth_update_timeout(scp, 0); |
815 | } | 770 | } |
816 | } | 771 | } |
817 | } | 772 | } |
818 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 773 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
819 | } | 774 | } |
820 | 775 | ||
821 | static void gdth_start_timeout(int hanum, int busnum, int id) | 776 | static void gdth_start_timeout(gdth_ha_str *ha, int busnum, int id) |
822 | { | 777 | { |
823 | gdth_ha_str *ha; | ||
824 | ulong flags; | 778 | ulong flags; |
825 | Scsi_Cmnd *scp; | 779 | Scsi_Cmnd *scp; |
826 | unchar b, t; | 780 | unchar b, t; |
827 | 781 | ||
828 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
829 | spin_lock_irqsave(&ha->smp_lock, flags); | 782 | spin_lock_irqsave(&ha->smp_lock, flags); |
830 | 783 | ||
831 | for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { | 784 | for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { |
832 | if (scp->done != gdth_scsi_done) { | 785 | struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); |
833 | b = virt_ctr ? | 786 | if (!cmndinfo->internal_command) { |
834 | NUMDATA(scp->device->host)->busnum : scp->device->channel; | 787 | b = scp->device->channel; |
835 | t = scp->device->id; | 788 | t = scp->device->id; |
836 | if (t == (unchar)id && b == (unchar)busnum) { | 789 | if (t == (unchar)id && b == (unchar)busnum) { |
837 | TRACE2(("gdth_start_timeout(): update_timeout()\n")); | 790 | TRACE2(("gdth_start_timeout(): update_timeout()\n")); |
838 | gdth_update_timeout(hanum, scp, scp->SCp.buffers_residual); | 791 | gdth_update_timeout(scp, cmndinfo->timeout); |
839 | } | 792 | } |
840 | } | 793 | } |
841 | } | 794 | } |
842 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 795 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
843 | } | 796 | } |
844 | 797 | ||
845 | static int gdth_update_timeout(int hanum, Scsi_Cmnd *scp, int timeout) | 798 | static int gdth_update_timeout(Scsi_Cmnd *scp, int timeout) |
846 | { | 799 | { |
847 | int oldto; | 800 | int oldto; |
848 | 801 | ||