Commit 8a617db5 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by James Bottomley

[PATCH] tmscsim: Store pDCB in device->hostdata

On Sun, 23 May 2004, Christoph Hellwig wrote:
> The other thing is that most calls to dc390_findDCB could probably be
> replaced with stroing the pDCB in scsi_device->hostdata on slave_alloc,
> but that could aswell be done in an incremental patch.

Done in the attached patch. Tested as usual and a bit harder.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent c9c5f351
...@@ -1042,7 +1042,7 @@ static void dc390_BuildSRB (Scsi_Cmnd* pcmd, PDCB pDCB, PSRB pSRB) ...@@ -1042,7 +1042,7 @@ static void dc390_BuildSRB (Scsi_Cmnd* pcmd, PDCB pDCB, PSRB pSRB)
static int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) static int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *))
{ {
PDCB pDCB; PDCB pDCB = (PDCB) cmd->device->hostdata;
PSRB pSRB; PSRB pSRB;
PACB pACB = (PACB) cmd->device->host->hostdata; PACB pACB = (PACB) cmd->device->host->hostdata;
...@@ -1059,8 +1059,6 @@ static int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) ...@@ -1059,8 +1059,6 @@ static int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *))
goto fail; goto fail;
} }
pDCB = dc390_findDCB (pACB, cmd->device->id, cmd->device->lun);
/* Should it be: BUG_ON(!pDCB); ? */ /* Should it be: BUG_ON(!pDCB); ? */
if (!pDCB) if (!pDCB)
...@@ -1286,7 +1284,7 @@ static void dc390_dumpinfo (PACB pACB, PDCB pDCB, PSRB pSRB) ...@@ -1286,7 +1284,7 @@ static void dc390_dumpinfo (PACB pACB, PDCB pDCB, PSRB pSRB)
static int DC390_abort (Scsi_Cmnd *cmd) static int DC390_abort (Scsi_Cmnd *cmd)
{ {
PDCB pDCB; PDCB pDCB = (PDCB) cmd->device->hostdata;
PSRB pSRB, psrb; PSRB pSRB, psrb;
UINT count, i; UINT count, i;
int status; int status;
...@@ -1296,7 +1294,6 @@ static int DC390_abort (Scsi_Cmnd *cmd) ...@@ -1296,7 +1294,6 @@ static int DC390_abort (Scsi_Cmnd *cmd)
printk ("DC390: Abort command (pid %li, Device %02i-%02i)\n", printk ("DC390: Abort command (pid %li, Device %02i-%02i)\n",
cmd->pid, cmd->device->id, cmd->device->lun); cmd->pid, cmd->device->id, cmd->device->lun);
pDCB = dc390_findDCB (pACB, cmd->device->id, cmd->device->lun);
if( !pDCB ) goto NOT_RUN; if( !pDCB ) goto NOT_RUN;
/* Added 98/07/02 KG */ /* Added 98/07/02 KG */
...@@ -1909,6 +1906,7 @@ static int dc390_slave_alloc(struct scsi_device *scsi_device) ...@@ -1909,6 +1906,7 @@ static int dc390_slave_alloc(struct scsi_device *scsi_device)
PACB pACB = (PACB) scsi_device->host->hostdata; PACB pACB = (PACB) scsi_device->host->hostdata;
dc390_initDCB(pACB, &pDCB, scsi_device->id, scsi_device->lun); dc390_initDCB(pACB, &pDCB, scsi_device->id, scsi_device->lun);
if (pDCB != NULL) { if (pDCB != NULL) {
scsi_device->hostdata = pDCB;
pACB->scan_devices = 1; pACB->scan_devices = 1;
return 0; return 0;
} }
...@@ -1924,7 +1922,7 @@ static int dc390_slave_alloc(struct scsi_device *scsi_device) ...@@ -1924,7 +1922,7 @@ static int dc390_slave_alloc(struct scsi_device *scsi_device)
static void dc390_slave_destroy(struct scsi_device *scsi_device) static void dc390_slave_destroy(struct scsi_device *scsi_device)
{ {
PACB pACB = (PACB) scsi_device->host->hostdata; PACB pACB = (PACB) scsi_device->host->hostdata;
PDCB pDCB = dc390_findDCB (pACB, scsi_device->id, scsi_device->lun);; PDCB pDCB = (PDCB) scsi_device->hostdata;
pACB->scan_devices = 0; pACB->scan_devices = 0;
if (pDCB != NULL) if (pDCB != NULL)
dc390_remove_dev(pACB, pDCB); dc390_remove_dev(pACB, pDCB);
...@@ -1978,7 +1976,7 @@ static int __devinit dc390_init_one(struct pci_dev *dev, ...@@ -1978,7 +1976,7 @@ static int __devinit dc390_init_one(struct pci_dev *dev,
if (!scsi_host) if (!scsi_host)
goto nomem; goto nomem;
pACB = (PACB)scsi_host->hostdata; pACB = (PACB) scsi_host->hostdata;
if (dc390_init(scsi_host, io_port, irq, dev, dc390_adapterCnt)) { if (dc390_init(scsi_host, io_port, irq, dev, dc390_adapterCnt)) {
ret = -EBUSY; ret = -EBUSY;
...@@ -2180,7 +2178,7 @@ static int DC390_proc_info (struct Scsi_Host *shpnt, char *buffer, char **start, ...@@ -2180,7 +2178,7 @@ static int DC390_proc_info (struct Scsi_Host *shpnt, char *buffer, char **start,
static int dc390_shutdown (struct Scsi_Host *host) static int dc390_shutdown (struct Scsi_Host *host)
{ {
UCHAR bval; UCHAR bval;
PACB pACB = (PACB)(host->hostdata); PACB pACB = (PACB) host->hostdata;
/* pACB->soft_reset(host); */ /* pACB->soft_reset(host); */
...@@ -2200,7 +2198,7 @@ static int dc390_shutdown (struct Scsi_Host *host) ...@@ -2200,7 +2198,7 @@ static int dc390_shutdown (struct Scsi_Host *host)
static void dc390_freeDCBs (struct Scsi_Host *host) static void dc390_freeDCBs (struct Scsi_Host *host)
{ {
PDCB pDCB, nDCB; PDCB pDCB, nDCB;
PACB pACB = (PACB)(host->hostdata); PACB pACB = (PACB) host->hostdata;
pDCB = pACB->pLinkDCB; pDCB = pACB->pLinkDCB;
if (!pDCB) return; if (!pDCB) return;
...@@ -2219,7 +2217,7 @@ static void dc390_freeDCBs (struct Scsi_Host *host) ...@@ -2219,7 +2217,7 @@ static void dc390_freeDCBs (struct Scsi_Host *host)
static int DC390_release (struct Scsi_Host *host) static int DC390_release (struct Scsi_Host *host)
{ {
DC390_IFLAGS; DC390_IFLAGS;
PACB pACB = (PACB)(host->hostdata); PACB pACB = (PACB) host->hostdata;
DC390_LOCK_IO(host); DC390_LOCK_IO(host);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment