[libata] ata_tf_to_host cleanups
[powerpc.git] / drivers / scsi / eata.c
index 8394529..3d13fde 100644 (file)
@@ -1357,7 +1357,7 @@ static int port_detect(unsigned long port_base, unsigned int j,
 
        for (i = 0; i < shost->can_queue; i++) {
                size_t sz = shost->sg_tablesize *sizeof(struct sg_list);
-               unsigned int gfp_mask = (shost->unchecked_isa_dma ? GFP_DMA : 0) | GFP_ATOMIC;
+               gfp_t gfp_mask = (shost->unchecked_isa_dma ? GFP_DMA : 0) | GFP_ATOMIC;
                ha->cp[i].sglist = kmalloc(sz, gfp_mask);
                if (!ha->cp[i].sglist) {
                        printk
@@ -1899,16 +1899,6 @@ static int eata2x_eh_abort(struct scsi_cmnd *SCarg)
                        printk("%s: abort, mbox %d, interrupt pending.\n",
                               ha->board_name, i);
 
-               if (SCarg->eh_state == SCSI_STATE_TIMEOUT) {
-                       unmap_dma(i, ha);
-                       SCarg->host_scribble = NULL;
-                       ha->cp_stat[i] = FREE;
-                       printk
-                           ("%s, abort, mbox %d, eh_state timeout, pid %ld.\n",
-                            ha->board_name, i, SCarg->pid);
-                       return SUCCESS;
-               }
-
                return FAILED;
        }
 
@@ -1948,16 +1938,20 @@ static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg)
               ha->board_name, SCarg->device->channel, SCarg->device->id,
               SCarg->device->lun, SCarg->pid);
 
+       spin_lock_irq(shost->host_lock);
+
        if (SCarg->host_scribble == NULL)
                printk("%s: reset, pid %ld inactive.\n", ha->board_name, SCarg->pid);
 
        if (ha->in_reset) {
                printk("%s: reset, exit, already in reset.\n", ha->board_name);
+               spin_unlock_irq(shost->host_lock);
                return FAILED;
        }
 
        if (wait_on_busy(shost->io_port, MAXLOOP)) {
                printk("%s: reset, exit, timeout error.\n", ha->board_name);
+               spin_unlock_irq(shost->host_lock);
                return FAILED;
        }
 
@@ -2012,6 +2006,7 @@ static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg)
 
        if (do_dma(shost->io_port, 0, RESET_PIO)) {
                printk("%s: reset, cannot reset, timeout error.\n", ha->board_name);
+               spin_unlock_irq(shost->host_lock);
                return FAILED;
        }
 
@@ -2024,9 +2019,12 @@ static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg)
        ha->in_reset = 1;
 
        spin_unlock_irq(shost->host_lock);
+
+       /* FIXME: use a sleep instead */
        time = jiffies;
        while ((jiffies - time) < (10 * HZ) && limit++ < 200000)
                udelay(100L);
+
        spin_lock_irq(shost->host_lock);
 
        printk("%s: reset, interrupts disabled, loops %d.\n", ha->board_name, limit);
@@ -2076,6 +2074,7 @@ static int eata2x_eh_host_reset(struct scsi_cmnd *SCarg)
        else
                printk("%s: reset, exit.\n", ha->board_name);
 
+       spin_unlock_irq(shost->host_lock);
        return SUCCESS;
 }