[SCSI] advansys: Remove ASC_SELECT_QUEUE_DEPTHS
[safe/jmp/linux-2.6] / drivers / scsi / NCR53C9x.c
index 640590b..96e8e29 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <linux/module.h>
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/types.h>
@@ -96,8 +95,10 @@ enum {
 /* The master ring of all esp hosts we are managing in this driver. */
 static struct NCR_ESP *espchain;
 int nesps = 0, esps_in_use = 0, esps_running = 0;
+EXPORT_SYMBOL(nesps);
+EXPORT_SYMBOL(esps_running);
 
-irqreturn_t esp_intr(int irq, void *dev_id, struct pt_regs *pregs);
+irqreturn_t esp_intr(int irq, void *dev_id);
 
 /* Debugging routines */
 static struct esp_cmdstrings {
@@ -525,16 +526,21 @@ void esp_bootup_reset(struct NCR_ESP *esp, struct ESP_regs *eregs)
        /* Eat any bitrot in the chip and we are done... */
        trash = esp_read(eregs->esp_intrpt);
 }
+EXPORT_SYMBOL(esp_bootup_reset);
 
 /* Allocate structure and insert basic data such as SCSI chip frequency
  * data and a pointer to the device
  */
-struct NCR_ESP* esp_allocate(struct scsi_host_template *tpnt, void *esp_dev)
+struct NCR_ESP* esp_allocate(struct scsi_host_template *tpnt, void *esp_dev,
+                            int hotplug)
 {
        struct NCR_ESP *esp, *elink;
        struct Scsi_Host *esp_host;
 
-       esp_host = scsi_register(tpnt, sizeof(struct NCR_ESP));
+       if (hotplug)
+               esp_host = scsi_host_alloc(tpnt, sizeof(struct NCR_ESP));
+       else
+               esp_host = scsi_register(tpnt, sizeof(struct NCR_ESP));
        if(!esp_host)
                panic("Cannot register ESP SCSI host");
        esp = (struct NCR_ESP *) esp_host->hostdata;
@@ -769,6 +775,7 @@ const char *esp_info(struct Scsi_Host *host)
                panic("Bogon ESP revision");
        };
 }
+EXPORT_SYMBOL(esp_info);
 
 /* From Wolfgang Stanglmeier's NCR scsi driver. */
 struct info_str
@@ -899,6 +906,7 @@ int esp_proc_info(struct Scsi_Host *shost, char *buffer, char **start, off_t off
                *start = buffer;
        return esp_host_info(esp, buffer, offset, length);
 }
+EXPORT_SYMBOL(esp_proc_info);
 
 static void esp_get_dmabufs(struct NCR_ESP *esp, Scsi_Cmnd *sp)
 {
@@ -912,7 +920,7 @@ static void esp_get_dmabufs(struct NCR_ESP *esp, Scsi_Cmnd *sp)
                        sp->SCp.ptr =
                                (char *) virt_to_phys(sp->request_buffer);
        } else {
-               sp->SCp.buffer = (struct scatterlist *) sp->buffer;
+               sp->SCp.buffer = (struct scatterlist *) sp->request_buffer;
                sp->SCp.buffers_residual = sp->use_sg - 1;
                sp->SCp.this_residual = sp->SCp.buffer->length;
                if (esp->dma_mmu_get_scsi_sgl)
@@ -1377,7 +1385,7 @@ int esp_abort(Scsi_Cmnd *SCptr)
                                this->host_scribble = NULL;
                                esp_release_dmabufs(esp, this);
                                this->result = DID_ABORT << 16;
-                               this->done(this);
+                               this->scsi_done(this);
                                if(don)
                                        esp->dma_ints_on(esp);
                                return SUCCESS;
@@ -1799,6 +1807,7 @@ static int esp_do_data(struct NCR_ESP *esp, struct ESP_regs *eregs)
                 */
                int oldphase, i = 0; /* or where we left off last time ?? esp->current_data ?? */
                int fifocnt = 0;
+               unsigned char *p = phys_to_virt((unsigned long)SCptr->SCp.ptr);
 
                oldphase = esp_read(eregs->esp_status) & ESP_STAT_PMASK;
 
@@ -1860,7 +1869,7 @@ static int esp_do_data(struct NCR_ESP *esp, struct ESP_regs *eregs)
 
                                /* read fifo */
                                for(j=0;j<fifocnt;j++)
-                                       SCptr->SCp.ptr[i++] = esp_read(eregs->esp_fdata);
+                                       p[i++] = esp_read(eregs->esp_fdata);
 
                                ESPDATA(("(%d) ", i));
 
@@ -1882,7 +1891,7 @@ static int esp_do_data(struct NCR_ESP *esp, struct ESP_regs *eregs)
 
                                /* fill fifo */
                                for(j=0;j<this_count;j++)
-                                       esp_write(eregs->esp_fdata, SCptr->SCp.ptr[i++]);
+                                       esp_write(eregs->esp_fdata, p[i++]);
 
                                /* how many left if this goes out ?? */
                                hmuch -= this_count;
@@ -2152,29 +2161,23 @@ static int esp_do_data_finale(struct NCR_ESP *esp,
  */
 static int esp_should_clear_sync(Scsi_Cmnd *sp)
 {
-       unchar cmd1 = sp->cmnd[0];
-       unchar cmd2 = sp->data_cmnd[0];
+       unchar cmd = sp->cmnd[0];
 
        /* These cases are for spinning up a disk and
         * waiting for that spinup to complete.
         */
-       if(cmd1 == START_STOP ||
-          cmd2 == START_STOP)
+       if(cmd == START_STOP)
                return 0;
 
-       if(cmd1 == TEST_UNIT_READY ||
-          cmd2 == TEST_UNIT_READY)
+       if(cmd == TEST_UNIT_READY)
                return 0;
 
        /* One more special case for SCSI tape drives,
         * this is what is used to probe the device for
         * completion of a rewind or tape load operation.
         */
-       if(sp->device->type == TYPE_TAPE) {
-               if(cmd1 == MODE_SENSE ||
-                  cmd2 == MODE_SENSE)
-                       return 0;
-       }
+       if(sp->device->type == TYPE_TAPE && cmd == MODE_SENSE)
+               return 0;
 
        return 1;
 }
@@ -3537,9 +3540,10 @@ state_machine:
        if(esp->dma_irq_exit)
                esp->dma_irq_exit(esp);
 }
+EXPORT_SYMBOL(esp_handle);
 
 #ifndef CONFIG_SMP
-irqreturn_t esp_intr(int irq, void *dev_id, struct pt_regs *pregs)
+irqreturn_t esp_intr(int irq, void *dev_id)
 {
        struct NCR_ESP *esp;
        unsigned long flags;
@@ -3576,7 +3580,7 @@ repeat:
 }
 #else
 /* For SMP we only service one ESP on the list list at our IRQ level! */
-irqreturn_t esp_intr(int irq, void *dev_id, struct pt_regs *pregs)
+irqreturn_t esp_intr(int irq, void *dev_id)
 {
        struct NCR_ESP *esp;
        unsigned long flags;
@@ -3608,11 +3612,10 @@ out:
 int esp_slave_alloc(struct scsi_device *SDptr)
 {
        struct esp_device *esp_dev =
-               kmalloc(sizeof(struct esp_device), GFP_ATOMIC);
+               kzalloc(sizeof(struct esp_device), GFP_ATOMIC);
 
        if (!esp_dev)
                return -ENOMEM;
-       memset(esp_dev, 0, sizeof(struct esp_device));
        SDptr->hostdata = esp_dev;
        return 0;
 }
@@ -3634,6 +3637,7 @@ void esp_release(void)
        esps_in_use--;
        esps_running = esps_in_use;
 }
+EXPORT_SYMBOL(esp_release);
 #endif
 
 EXPORT_SYMBOL(esp_abort);