aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/gdth.c
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@linux.intel.com>2007-10-02 16:40:22 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-10-12 14:55:11 -0400
commitb8bff2aeafb1959de27bd889d1c103577b36712f (patch)
tree6e199ede597bc3cbd97125983fa1c74c2a4c0745 /drivers/scsi/gdth.c
parent28424d3a503d43482a5537e556f7b7652d8e56d8 (diff)
gdth: Make one abuse of scsi_cmnd less obvious
Rather than having internal commands abuse scsi_done to call gdth_scsi_done, have all the places that use to call scsi_done directly call gdth_scsi_done, which now checks whether the command was internal, and calls scsi_done if not. Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/gdth.c')
-rw-r--r--drivers/scsi/gdth.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 317a2826af05..fe5db2da26b7 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -716,10 +716,12 @@ static void gdth_delay(int milliseconds)
716#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 716#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
717static void gdth_scsi_done(struct scsi_cmnd *scp) 717static void gdth_scsi_done(struct scsi_cmnd *scp)
718{ 718{
719 TRACE2(("gdth_scsi_done()\n")); 719 TRACE2(("gdth_scsi_done()\n"));
720 720
721 if (IS_GDTH_INTERNAL_CMD(scp)) 721 if (IS_GDTH_INTERNAL_CMD(scp))
722 complete((struct completion *)scp->request); 722 complete((struct completion *)scp->request);
723 else
724 scp->scsi_done(scp);
723} 725}
724 726
725int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd, 727int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd,
@@ -742,7 +744,7 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd,
742 memcpy(scp->cmnd, cmnd, 12); 744 memcpy(scp->cmnd, cmnd, 12);
743 scp->SCp.this_residual = IOCTL_PRI; /* priority */ 745 scp->SCp.this_residual = IOCTL_PRI; /* priority */
744 scp->underflow = GDTH_MAGIC; 746 scp->underflow = GDTH_MAGIC;
745 gdth_queuecommand(scp, gdth_scsi_done); 747 gdth_queuecommand(scp, NULL);
746 wait_for_completion(&wait); 748 wait_for_completion(&wait);
747 749
748 rval = scp->SCp.Status; 750 rval = scp->SCp.Status;
@@ -2508,7 +2510,7 @@ static void gdth_next(int hanum)
2508 if (!nscp->SCp.have_data_in) 2510 if (!nscp->SCp.have_data_in)
2509 nscp->SCp.have_data_in++; 2511 nscp->SCp.have_data_in++;
2510 else 2512 else
2511 nscp->scsi_done(nscp); 2513 gdth_scsi_done(nscp);
2512 } 2514 }
2513 } else if (IS_GDTH_INTERNAL_CMD(nscp)) { 2515 } else if (IS_GDTH_INTERNAL_CMD(nscp)) {
2514 if (!(cmd_index=gdth_special_cmd(hanum,nscp))) 2516 if (!(cmd_index=gdth_special_cmd(hanum,nscp)))
@@ -2527,7 +2529,7 @@ static void gdth_next(int hanum)
2527 if (!nscp->SCp.have_data_in) 2529 if (!nscp->SCp.have_data_in)
2528 nscp->SCp.have_data_in++; 2530 nscp->SCp.have_data_in++;
2529 else 2531 else
2530 nscp->scsi_done(nscp); 2532 gdth_scsi_done(nscp);
2531 } else { 2533 } else {
2532 switch (nscp->cmnd[0]) { 2534 switch (nscp->cmnd[0]) {
2533 case TEST_UNIT_READY: 2535 case TEST_UNIT_READY:
@@ -2553,9 +2555,9 @@ static void gdth_next(int hanum)
2553 if (!nscp->SCp.have_data_in) 2555 if (!nscp->SCp.have_data_in)
2554 nscp->SCp.have_data_in++; 2556 nscp->SCp.have_data_in++;
2555 else 2557 else
2556 nscp->scsi_done(nscp); 2558 gdth_scsi_done(nscp);
2557 } else if (gdth_internal_cache_cmd(hanum,nscp)) 2559 } else if (gdth_internal_cache_cmd(hanum, nscp))
2558 nscp->scsi_done(nscp); 2560 gdth_scsi_done(nscp);
2559 break; 2561 break;
2560 2562
2561 case ALLOW_MEDIUM_REMOVAL: 2563 case ALLOW_MEDIUM_REMOVAL:
@@ -2569,7 +2571,7 @@ static void gdth_next(int hanum)
2569 if (!nscp->SCp.have_data_in) 2571 if (!nscp->SCp.have_data_in)
2570 nscp->SCp.have_data_in++; 2572 nscp->SCp.have_data_in++;
2571 else 2573 else
2572 nscp->scsi_done(nscp); 2574 gdth_scsi_done(nscp);
2573 } else { 2575 } else {
2574 nscp->cmnd[3] = (ha->hdr[t].devtype&1) ? 1:0; 2576 nscp->cmnd[3] = (ha->hdr[t].devtype&1) ? 1:0;
2575 TRACE(("Prevent/allow r. %d rem. drive %d\n", 2577 TRACE(("Prevent/allow r. %d rem. drive %d\n",
@@ -2605,8 +2607,8 @@ static void gdth_next(int hanum)
2605 if (!nscp->SCp.have_data_in) 2607 if (!nscp->SCp.have_data_in)
2606 nscp->SCp.have_data_in++; 2608 nscp->SCp.have_data_in++;
2607 else 2609 else
2608 nscp->scsi_done(nscp); 2610 gdth_scsi_done(nscp);
2609 } else if (!(cmd_index=gdth_fill_cache_cmd(hanum,nscp,t))) 2611 } else if (!(cmd_index=gdth_fill_cache_cmd(hanum, nscp, t)))
2610 this_cmd = FALSE; 2612 this_cmd = FALSE;
2611 break; 2613 break;
2612 2614
@@ -2620,7 +2622,7 @@ static void gdth_next(int hanum)
2620 if (!nscp->SCp.have_data_in) 2622 if (!nscp->SCp.have_data_in)
2621 nscp->SCp.have_data_in++; 2623 nscp->SCp.have_data_in++;
2622 else 2624 else
2623 nscp->scsi_done(nscp); 2625 gdth_scsi_done(nscp);
2624 break; 2626 break;
2625 } 2627 }
2626 } 2628 }
@@ -3633,7 +3635,7 @@ static irqreturn_t gdth_interrupt(int irq,void *dev_id)
3633 if (rval == 2) { 3635 if (rval == 2) {
3634 gdth_putq(hanum,scp,scp->SCp.this_residual); 3636 gdth_putq(hanum,scp,scp->SCp.this_residual);
3635 } else if (rval == 1) { 3637 } else if (rval == 1) {
3636 scp->scsi_done(scp); 3638 gdth_scsi_done(scp);
3637 } 3639 }
3638 3640
3639#ifdef INT_COAL 3641#ifdef INT_COAL
@@ -4928,14 +4930,15 @@ static int gdth_bios_param(Disk *disk,kdev_t dev,int *ip)
4928} 4930}
4929 4931
4930 4932
4931static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *)) 4933static int gdth_queuecommand(struct scsi_cmnd *scp,
4934 void (*done)(struct scsi_cmnd *))
4932{ 4935{
4933 int hanum; 4936 int hanum;
4934 int priority; 4937 int priority;
4935 4938
4936 TRACE(("gdth_queuecommand() cmd 0x%x\n", scp->cmnd[0])); 4939 TRACE(("gdth_queuecommand() cmd 0x%x\n", scp->cmnd[0]));
4937 4940
4938 scp->scsi_done = (void *)done; 4941 scp->scsi_done = done;
4939 scp->SCp.have_data_in = 1; 4942 scp->SCp.have_data_in = 1;
4940 scp->SCp.phase = -1; 4943 scp->SCp.phase = -1;
4941 scp->SCp.sent_command = -1; 4944 scp->SCp.sent_command = -1;