]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/scsi/sun3_NCR5380.c
Convert files to UTF-8 and some cleanups
[net-next-2.6.git] / drivers / scsi / sun3_NCR5380.c
index 3b3f3050a877f0e221ee49fb649b45cc20b9acbc..4aafe89b557f75c55ab0583141fdaa223834cc41 100644 (file)
@@ -266,7 +266,7 @@ static struct scsi_host_template *the_template = NULL;
        (struct NCR5380_hostdata *)(in)->hostdata
 #define        HOSTDATA(in) ((struct NCR5380_hostdata *)(in)->hostdata)
 
-#define        NEXT(cmd)       ((struct scsi_cmnd *)((cmd)->host_scribble))
+#define        NEXT(cmd)       (*(struct scsi_cmnd **)&((cmd)->host_scribble))
 #define        NEXTADDR(cmd)   ((struct scsi_cmnd **)&((cmd)->host_scribble))
 
 #define        HOSTNO          instance->host_no
@@ -650,7 +650,7 @@ __inline__ void NCR5380_print_phase(struct Scsi_Host *instance) { };
 #include <linux/interrupt.h>
 
 static volatile int main_running = 0;
-static DECLARE_WORK(NCR5380_tqueue, (void (*)(void*))NCR5380_main, NULL);
+static DECLARE_WORK(NCR5380_tqueue, NCR5380_main);
 
 static __inline__ void queue_main(void)
 {
@@ -1031,7 +1031,7 @@ static int NCR5380_queue_command(struct scsi_cmnd *cmd,
  *  reenable them.  This prevents reentrancy and kernel stack overflow.
  */    
     
-static void NCR5380_main (void *bl)
+static void NCR5380_main (struct work_struct *bl)
 {
     struct scsi_cmnd *tmp, *prev;
     struct Scsi_Host *instance = first_instance;
@@ -1271,7 +1271,7 @@ static irqreturn_t NCR5380_intr (int irq, void *dev_id)
        NCR_PRINT(NDEBUG_INTR);
        if ((NCR5380_read(STATUS_REG) & (SR_SEL|SR_IO)) == (SR_SEL|SR_IO)) {
            done = 0;
-           ENABLE_IRQ();
+//         ENABLE_IRQ();
            INT_PRINTK("scsi%d: SEL interrupt\n", HOSTNO);
            NCR5380_reselect(instance);
            (void) NCR5380_read(RESET_PARITY_INTERRUPT_REG);
@@ -1304,7 +1304,7 @@ static irqreturn_t NCR5380_intr (int irq, void *dev_id)
                INT_PRINTK("scsi%d: PHASE MISM or EOP interrupt\n", HOSTNO);
                NCR5380_dma_complete( instance );
                done = 0;
-               ENABLE_IRQ();
+//             ENABLE_IRQ();
            } else
 #endif /* REAL_DMA */
            {
@@ -1596,7 +1596,7 @@ static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd,
      * IO while SEL is true. But again, there are some disks out the in the
      * world that do that nevertheless. (Somebody claimed that this announces
      * reselection capability of the target.) So we better skip that test and
-     * only wait for BSY... (Famous german words: Der Klgere gibt nach :-)
+     * only wait for BSY... (Famous german words: Der Klügere gibt nach :-)
      */
 
     while (time_before(jiffies, timeout) && !(NCR5380_read(STATUS_REG) & 
@@ -2055,7 +2055,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
                sink = 1;
                do_abort(instance);
                cmd->result = DID_ERROR  << 16;
-               cmd->done(cmd);
+               cmd->scsi_done(cmd);
                return;
 #endif
            case PHASE_DATAIN:
@@ -2115,7 +2115,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
                        sink = 1;
                        do_abort(instance);
                        cmd->result = DID_ERROR  << 16;
-                       cmd->done(cmd);
+                       cmd->scsi_done(cmd);
                        /* XXX - need to source or sink data here, as appropriate */
                    } else {
 #ifdef REAL_DMA
@@ -2254,25 +2254,21 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
                        cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
                    
 #ifdef AUTOSENSE
+                   if ((cmd->cmnd[0] == REQUEST_SENSE) &&
+                                               hostdata->ses.cmd_len) {
+                       scsi_eh_restore_cmnd(cmd, &hostdata->ses);
+                       hostdata->ses.cmd_len = 0 ;
+                   }
+
                    if ((cmd->cmnd[0] != REQUEST_SENSE) && 
                        (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
+                       scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0);
                        ASEN_PRINTK("scsi%d: performing request sense\n",
                                    HOSTNO);
-                       cmd->cmnd[0] = REQUEST_SENSE;
-                       cmd->cmnd[1] &= 0xe0;
-                       cmd->cmnd[2] = 0;
-                       cmd->cmnd[3] = 0;
-                       cmd->cmnd[4] = sizeof(cmd->sense_buffer);
-                       cmd->cmnd[5] = 0;
-                       cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]);
-
-                       cmd->use_sg = 0;
                        /* this is initialized from initialize_SCp 
                        cmd->SCp.buffer = NULL;
                        cmd->SCp.buffers_residual = 0;
                        */
-                       cmd->request_buffer = (char *) cmd->sense_buffer;
-                       cmd->request_bufflen = sizeof(cmd->sense_buffer);
 
                        local_irq_save(flags);
                        LIST(cmd,hostdata->issue_queue);