# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1592 -> 1.1593 # drivers/scsi/tmscsim.c 1.29 -> 1.30 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 04/02/22 hch@bird.bsdonline.org 1.1593 # use slave_alloc / slave_destory # -------------------------------------------- # diff -Nru a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c --- a/drivers/scsi/tmscsim.c Sun Feb 22 19:09:19 2004 +++ b/drivers/scsi/tmscsim.c Sun Feb 22 19:09:19 2004 @@ -355,7 +355,6 @@ irqreturn_t do_DC390_Interrupt( int, void *, struct pt_regs *); int dc390_initAdapter( PSH psh, ULONG io_port, UCHAR Irq, UCHAR index ); -void dc390_initDCB( PACB pACB, PDCB *ppDCB, UCHAR id, UCHAR lun); void dc390_updateDCB (PACB pACB, PDCB pDCB); static int DC390_release(struct Scsi_Host *host); @@ -1105,7 +1104,7 @@ int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) { - PDCB pDCB; + PDCB pDCB = cmd->device->hostdata; PSRB pSRB; PACB pACB = (PACB) cmd->device->host->hostdata; DC390_AFLAGS; @@ -1131,15 +1130,6 @@ !(pACB->DCBmap[cmd->device->id] & (1 << cmd->device->lun)) ) { pACB->scan_devices = 1; - - dc390_initDCB( pACB, &pDCB, cmd->device->id, cmd->device->lun ); - if (!pDCB) - { - printk (KERN_ERR "DC390: kmalloc for DCB failed, target %02x lun %02x\n", - cmd->device->id, cmd->device->lun); - goto fail; - } - } else if( !(pACB->scan_devices) && !(pACB->DCBmap[cmd->device->id] & (1 << cmd->device->lun)) ) { @@ -1147,16 +1137,6 @@ cmd->device->id, cmd->device->lun); goto fail; } - else - { - pDCB = dc390_findDCB (pACB, cmd->device->id, cmd->device->lun); - if (!pDCB) - { /* should never happen */ - printk (KERN_ERR "DC390: no DCB failed, target %02x lun %02x\n", - cmd->device->id, cmd->device->lun); - goto fail; - } - } pACB->Cmds++; cmd->scsi_done = done; @@ -1378,7 +1358,7 @@ int DC390_abort (Scsi_Cmnd *cmd) { - PDCB pDCB; + PDCB pDCB = cmd->device->hostdata; PSRB pSRB, psrb; UINT count, i; int status; @@ -1391,9 +1371,6 @@ printk ("DC390: Abort command (pid %li, Device %02i-%02i)\n", cmd->pid, cmd->device->id, cmd->device->lun); - pDCB = dc390_findDCB (pACB, cmd->device->id, cmd->device->lun); - if( !pDCB ) goto NOT_RUN; - /* Added 98/07/02 KG */ /* pSRB = pDCB->pActiveSRB; @@ -2069,6 +2046,27 @@ } #endif /* ! NEW_PCI */ +static int dc390_slave_alloc(struct scsi_device *sdev) +{ + PACB acb = (PACB) sdev->host->hostdata; + PDCB dcb; + + dc390_initDCB(acb, &dcb, sdev->id, sdev->lun); + if (!dcb) + return -ENOMEM; + + sdev->hostdata = dcb; + return 0; +} + +static void dc390_slave_destroy(struct scsi_device *sdev) +{ + PACB acb = (PACB) sdev->host->hostdata; + PDCB dcb = sdev->hostdata; + + dc390_remove_dev(acb, dcb); +} + static void __init dc390_set_pci_cfg (PDEVDECL) { USHORT cmd; @@ -2297,25 +2295,6 @@ return( 0 ); } -void dc390_freeDCBs (struct Scsi_Host *host) -{ - PDCB pDCB, nDCB; - PACB pACB = (PACB)(host->hostdata); - - pDCB = pACB->pLinkDCB; - if (!pDCB) return; - do - { - nDCB = pDCB->pNextDCB; - DCBDEBUG(printk (KERN_INFO "DC390: Free DCB (ID %i, LUN %i): %p\n",\ - pDCB->TargetID, pDCB->TargetLUN, pDCB)); - //kfree (pDCB); - dc390_remove_dev (pACB, pDCB); - pDCB = nDCB; - } while (pDCB && pACB->pLinkDCB); - -} - int DC390_release (struct Scsi_Host *host) { DC390_AFLAGS DC390_IFLAGS; @@ -2334,7 +2313,6 @@ } release_region(host->io_port,host->n_io_port); - dc390_freeDCBs (host); DC390_UNLOCK_ACB; DC390_UNLOCK_IO(host); scsi_unregister(host); @@ -2347,6 +2325,8 @@ .name = DC390_BANNER " V" DC390_VERSION, .detect = DC390_detect, .release = DC390_release, + .slave_alloc = dc390_slave_alloc, + .slave_destroy = dc390_slave_destroy, .queuecommand = DC390_queue_command, .eh_abort_handler = DC390_abort, .eh_bus_reset_handler = DC390_reset,