diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-09-25 12:42:03 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:52:41 -0400 |
commit | 687d2bc4877081a44c41b5b312e012cc69edda53 (patch) | |
tree | 8daf04207eb3fb61fe50aa1c051d09e9060e3de6 /drivers/scsi/gdth.c | |
parent | 9ec76fbf7d6da3e98070a7059699d0ca019b0c9b (diff) |
[SCSI] gdth: Stop abusing ->done for internal commands
The ->done member was being used to mark commands as being internal.
I decided to put a magic number in ->underflow instead. I believe this
to be safe as no current user of ->underflow has any of the bottom 9
bits set.
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/gdth.c')
-rw-r--r-- | drivers/scsi/gdth.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index b20c188cc529..317a2826af05 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -692,6 +692,9 @@ static const struct file_operations gdth_fops = { | |||
692 | .release = gdth_close, | 692 | .release = gdth_close, |
693 | }; | 693 | }; |
694 | 694 | ||
695 | #define GDTH_MAGIC 0xc2e7c389 /* I got it from /dev/urandom */ | ||
696 | #define IS_GDTH_INTERNAL_CMD(scp) (scp->underflow == GDTH_MAGIC) | ||
697 | |||
695 | #include "gdth_proc.h" | 698 | #include "gdth_proc.h" |
696 | #include "gdth_proc.c" | 699 | #include "gdth_proc.c" |
697 | 700 | ||
@@ -715,7 +718,7 @@ static void gdth_scsi_done(struct scsi_cmnd *scp) | |||
715 | { | 718 | { |
716 | TRACE2(("gdth_scsi_done()\n")); | 719 | TRACE2(("gdth_scsi_done()\n")); |
717 | 720 | ||
718 | if (scp->request) | 721 | if (IS_GDTH_INTERNAL_CMD(scp)) |
719 | complete((struct completion *)scp->request); | 722 | complete((struct completion *)scp->request); |
720 | } | 723 | } |
721 | 724 | ||
@@ -738,7 +741,7 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd, | |||
738 | scp->cmd_len = 12; | 741 | scp->cmd_len = 12; |
739 | memcpy(scp->cmnd, cmnd, 12); | 742 | memcpy(scp->cmnd, cmnd, 12); |
740 | scp->SCp.this_residual = IOCTL_PRI; /* priority */ | 743 | scp->SCp.this_residual = IOCTL_PRI; /* priority */ |
741 | scp->done = gdth_scsi_done; /* some fn. test this */ | 744 | scp->underflow = GDTH_MAGIC; |
742 | gdth_queuecommand(scp, gdth_scsi_done); | 745 | gdth_queuecommand(scp, gdth_scsi_done); |
743 | wait_for_completion(&wait); | 746 | wait_for_completion(&wait); |
744 | 747 | ||
@@ -2355,7 +2358,7 @@ static void gdth_putq(int hanum,Scsi_Cmnd *scp,unchar priority) | |||
2355 | ha = HADATA(gdth_ctr_tab[hanum]); | 2358 | ha = HADATA(gdth_ctr_tab[hanum]); |
2356 | spin_lock_irqsave(&ha->smp_lock, flags); | 2359 | spin_lock_irqsave(&ha->smp_lock, flags); |
2357 | 2360 | ||
2358 | if (scp->done != gdth_scsi_done) { | 2361 | if (!IS_GDTH_INTERNAL_CMD(scp)) { |
2359 | scp->SCp.this_residual = (int)priority; | 2362 | scp->SCp.this_residual = (int)priority; |
2360 | b = virt_ctr ? NUMDATA(scp->device->host)->busnum:scp->device->channel; | 2363 | b = virt_ctr ? NUMDATA(scp->device->host)->busnum:scp->device->channel; |
2361 | t = scp->device->id; | 2364 | t = scp->device->id; |
@@ -2418,7 +2421,7 @@ static void gdth_next(int hanum) | |||
2418 | for (nscp = pscp = ha->req_first; nscp; nscp = (Scsi_Cmnd *)nscp->SCp.ptr) { | 2421 | for (nscp = pscp = ha->req_first; nscp; nscp = (Scsi_Cmnd *)nscp->SCp.ptr) { |
2419 | if (nscp != pscp && nscp != (Scsi_Cmnd *)pscp->SCp.ptr) | 2422 | if (nscp != pscp && nscp != (Scsi_Cmnd *)pscp->SCp.ptr) |
2420 | pscp = (Scsi_Cmnd *)pscp->SCp.ptr; | 2423 | pscp = (Scsi_Cmnd *)pscp->SCp.ptr; |
2421 | if (nscp->done != gdth_scsi_done) { | 2424 | if (!IS_GDTH_INTERNAL_CMD(nscp)) { |
2422 | b = virt_ctr ? | 2425 | b = virt_ctr ? |
2423 | NUMDATA(nscp->device->host)->busnum : nscp->device->channel; | 2426 | NUMDATA(nscp->device->host)->busnum : nscp->device->channel; |
2424 | t = nscp->device->id; | 2427 | t = nscp->device->id; |
@@ -2444,7 +2447,7 @@ static void gdth_next(int hanum) | |||
2444 | firsttime = FALSE; | 2447 | firsttime = FALSE; |
2445 | } | 2448 | } |
2446 | 2449 | ||
2447 | if (nscp->done != gdth_scsi_done) { | 2450 | if (!IS_GDTH_INTERNAL_CMD(nscp)) { |
2448 | if (nscp->SCp.phase == -1) { | 2451 | if (nscp->SCp.phase == -1) { |
2449 | nscp->SCp.phase = CACHESERVICE; /* default: cache svc. */ | 2452 | nscp->SCp.phase = CACHESERVICE; /* default: cache svc. */ |
2450 | if (nscp->cmnd[0] == TEST_UNIT_READY) { | 2453 | if (nscp->cmnd[0] == TEST_UNIT_READY) { |
@@ -2507,7 +2510,7 @@ static void gdth_next(int hanum) | |||
2507 | else | 2510 | else |
2508 | nscp->scsi_done(nscp); | 2511 | nscp->scsi_done(nscp); |
2509 | } | 2512 | } |
2510 | } else if (nscp->done == gdth_scsi_done) { | 2513 | } else if (IS_GDTH_INTERNAL_CMD(nscp)) { |
2511 | if (!(cmd_index=gdth_special_cmd(hanum,nscp))) | 2514 | if (!(cmd_index=gdth_special_cmd(hanum,nscp))) |
2512 | this_cmd = FALSE; | 2515 | this_cmd = FALSE; |
2513 | next_cmd = FALSE; | 2516 | next_cmd = FALSE; |
@@ -3848,7 +3851,7 @@ static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp) | |||
3848 | scp->sense_buffer[2] = NOT_READY; | 3851 | scp->sense_buffer[2] = NOT_READY; |
3849 | scp->result = (DID_OK << 16) | (CHECK_CONDITION << 1); | 3852 | scp->result = (DID_OK << 16) | (CHECK_CONDITION << 1); |
3850 | } | 3853 | } |
3851 | if (scp->done != gdth_scsi_done) { | 3854 | if (!IS_GDTH_INTERNAL_CMD(scp)) { |
3852 | ha->dvr.size = sizeof(ha->dvr.eu.sync); | 3855 | ha->dvr.size = sizeof(ha->dvr.eu.sync); |
3853 | ha->dvr.eu.sync.ionode = hanum; | 3856 | ha->dvr.eu.sync.ionode = hanum; |
3854 | ha->dvr.eu.sync.service = service; | 3857 | ha->dvr.eu.sync.service = service; |
@@ -4945,7 +4948,7 @@ static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *)) | |||
4945 | #endif | 4948 | #endif |
4946 | 4949 | ||
4947 | priority = DEFAULT_PRI; | 4950 | priority = DEFAULT_PRI; |
4948 | if (scp->done == gdth_scsi_done) | 4951 | if (IS_GDTH_INTERNAL_CMD(scp)) |
4949 | priority = scp->SCp.this_residual; | 4952 | priority = scp->SCp.this_residual; |
4950 | else | 4953 | else |
4951 | gdth_update_timeout(hanum, scp, scp->timeout_per_command * 6); | 4954 | gdth_update_timeout(hanum, scp, scp->timeout_per_command * 6); |