fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / block / cciss_scsi.c
index 9e35de0..bb15051 100644 (file)
@@ -251,10 +251,6 @@ scsi_cmd_stack_free(int ctlr)
        stk->pool = NULL;
 }
 
-/* scsi_device_types comes from scsi.h */
-#define DEVICETYPE(n) (n<0 || n>MAX_SCSI_DEVICE_CODE) ? \
-       "Unknown" : scsi_device_types[n]
-
 #if 0
 static int xmargin=8;
 static int amargin=60;
@@ -389,7 +385,7 @@ cciss_scsi_add_entry(int ctlr, int hostno,
           time anyway (the scsi layer's inquiries will show that info) */
        if (hostno != -1)
                printk("cciss%d: %s device c%db%dt%dl%d added.\n", 
-                       ctlr, DEVICETYPE(sd->devtype), hostno, 
+                       ctlr, scsi_device_type(sd->devtype), hostno,
                        sd->bus, sd->target, sd->lun);
        return 0;
 }
@@ -407,7 +403,7 @@ cciss_scsi_remove_entry(int ctlr, int hostno, int entry)
                ccissscsi[ctlr].dev[i] = ccissscsi[ctlr].dev[i+1];
        ccissscsi[ctlr].ndevices--;
        printk("cciss%d: %s device c%db%dt%dl%d removed.\n",
-               ctlr, DEVICETYPE(sd.devtype), hostno, 
+               ctlr, scsi_device_type(sd.devtype), hostno,
                        sd.bus, sd.target, sd.lun);
 }
 
@@ -458,7 +454,7 @@ adjust_cciss_scsi_table(int ctlr, int hostno,
                if (found == 0) { /* device no longer present. */ 
                        changes++;
                        /* printk("cciss%d: %s device c%db%dt%dl%d removed.\n",
-                               ctlr, DEVICETYPE(csd->devtype), hostno, 
+                               ctlr, scsi_device_type(csd->devtype), hostno,
                                        csd->bus, csd->target, csd->lun); */
                        cciss_scsi_remove_entry(ctlr, hostno, i);
                        /* note, i not incremented */
@@ -468,7 +464,7 @@ adjust_cciss_scsi_table(int ctlr, int hostno,
                        printk("cciss%d: device c%db%dt%dl%d type changed "
                                "(device type now %s).\n",
                                ctlr, hostno, csd->bus, csd->target, csd->lun,
-                                       DEVICETYPE(csd->devtype));
+                                       scsi_device_type(csd->devtype));
                        csd->devtype = sd[j].devtype;
                        i++;    /* so just move along. */
                } else          /* device is same as it ever was, */
@@ -578,7 +574,7 @@ complete_scsi_command( CommandList_struct *cp, int timeout, __u32 tag)
 
        if (cmd->use_sg) {
                pci_unmap_sg(ctlr->pdev,
-                       cmd->buffer, cmd->use_sg,
+                       cmd->request_buffer, cmd->use_sg,
                                cmd->sc_data_direction); 
        }
        else if (cmd->request_bufflen) {
@@ -770,7 +766,7 @@ cciss_scsi_do_simple_cmd(ctlr_info_t *c,
                        int direction)
 {
        unsigned long flags;
-       DECLARE_COMPLETION(wait);
+       DECLARE_COMPLETION_ONSTACK(wait);
 
        cp->cmd_type = CMD_IOCTL_PEND;          // treat this like an ioctl 
        cp->scsi_cmd = NULL;
@@ -1027,12 +1023,11 @@ cciss_update_non_disk_devices(int cntl_num, int hostno)
        int i;
 
        c = (ctlr_info_t *) hba[cntl_num];      
-       ld_buff = kmalloc(reportlunsize, GFP_KERNEL);
+       ld_buff = kzalloc(reportlunsize, GFP_KERNEL);
        if (ld_buff == NULL) {
                printk(KERN_ERR "cciss: out of memory\n");
                return;
        }
-       memset(ld_buff, 0, reportlunsize);
        inq_buff = kmalloc(OBDR_TAPE_INQ_SIZE, GFP_KERNEL);
         if (inq_buff == NULL) {
                 printk(KERN_ERR "cciss: out of memory\n");
@@ -1099,7 +1094,7 @@ cciss_update_non_disk_devices(int cntl_num, int hostno)
                        if (ncurrent >= CCISS_MAX_SCSI_DEVS_PER_HBA) {
                                printk(KERN_INFO "cciss%d: %s ignored, "
                                        "too many devices.\n", cntl_num,
-                                       DEVICETYPE(devtype));
+                                       scsi_device_type(devtype));
                                break;
                        }
                        memcpy(&currentsd[ncurrent].scsi3addr[0], 
@@ -1211,7 +1206,7 @@ cciss_scatter_gather(struct pci_dev *pdev,
                struct scsi_cmnd *cmd)
 {
        unsigned int use_sg, nsegs=0, len;
-       struct scatterlist *scatter = (struct scatterlist *) cmd->buffer;
+       struct scatterlist *scatter = (struct scatterlist *) cmd->request_buffer;
        __u64 addr64;
 
        /* is it just one virtual address? */   
@@ -1233,7 +1228,7 @@ cciss_scatter_gather(struct pci_dev *pdev,
        } /* else, must be a list of virtual addresses.... */
        else if (cmd->use_sg <= MAXSGENTRIES) { /* not too many addrs? */
 
-               use_sg = pci_map_sg(pdev, cmd->buffer, cmd->use_sg, 
+               use_sg = pci_map_sg(pdev, cmd->request_buffer, cmd->use_sg,
                        cmd->sc_data_direction);
 
                for (nsegs=0; nsegs < use_sg; nsegs++) {
@@ -1316,7 +1311,7 @@ cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd
 
        cp->Request.Timeout = 0;
        memset(cp->Request.CDB, 0, sizeof(cp->Request.CDB));
-       if (cmd->cmd_len > sizeof(cp->Request.CDB)) BUG();
+       BUG_ON(cmd->cmd_len > sizeof(cp->Request.CDB));
        cp->Request.CDBLen = cmd->cmd_len;
        memcpy(cp->Request.CDB, cmd->cmnd, cmd->cmd_len);
        cp->Request.Type.Type = TYPE_CMD;