]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/esp_scsi.c
[SCSI] advansys: Remove `done' queue
[linux-2.6-omap-h63xx.git] / drivers / scsi / esp_scsi.c
index 3cd5bf723da4972e802a02e96238f19b8b99f822..77b06a983fa763023f245c010fb738616c7d18bc 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
+#include <linux/irqreturn.h>
 
 #include <asm/irq.h>
 #include <asm/io.h>
@@ -323,17 +324,14 @@ static void esp_reset_esp(struct esp *esp)
 static void esp_map_dma(struct esp *esp, struct scsi_cmnd *cmd)
 {
        struct esp_cmd_priv *spriv = ESP_CMD_PRIV(cmd);
-       struct scatterlist *sg = cmd->request_buffer;
+       struct scatterlist *sg = scsi_sglist(cmd);
        int dir = cmd->sc_data_direction;
        int total, i;
 
        if (dir == DMA_NONE)
                return;
 
-       BUG_ON(cmd->use_sg == 0);
-
-       spriv->u.num_sg = esp->ops->map_sg(esp, sg,
-                                          cmd->use_sg, dir);
+       spriv->u.num_sg = esp->ops->map_sg(esp, sg, scsi_sg_count(cmd), dir);
        spriv->cur_residue = sg_dma_len(sg);
        spriv->cur_sg = sg;
 
@@ -406,8 +404,7 @@ static void esp_unmap_dma(struct esp *esp, struct scsi_cmnd *cmd)
        if (dir == DMA_NONE)
                return;
 
-       esp->ops->unmap_sg(esp, cmd->request_buffer,
-                          spriv->u.num_sg, dir);
+       esp->ops->unmap_sg(esp, scsi_sglist(cmd), spriv->u.num_sg, dir);
 }
 
 static void esp_save_pointers(struct esp *esp, struct esp_cmd_entry *ent)
@@ -920,7 +917,7 @@ static void esp_event_queue_full(struct esp *esp, struct esp_cmd_entry *ent)
 static int esp_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
 {
        struct scsi_device *dev = cmd->device;
-       struct esp *esp = host_to_esp(dev->host);
+       struct esp *esp = shost_priv(dev->host);
        struct esp_cmd_priv *spriv;
        struct esp_cmd_entry *ent;
 
@@ -1706,17 +1703,17 @@ again:
                if (!dma_len) {
                        printk(KERN_ERR PFX "esp%d: DMA length is zero!\n",
                               esp->host->unique_id);
-                       printk(KERN_ERR PFX "esp%d: cur adr[%08x] len[%08x]\n",
+                       printk(KERN_ERR PFX "esp%d: cur adr[%08llx] len[%08x]\n",
                               esp->host->unique_id,
-                              esp_cur_dma_addr(ent, cmd),
+                              (unsigned long long)esp_cur_dma_addr(ent, cmd),
                               esp_cur_dma_len(ent, cmd));
                        esp_schedule_reset(esp);
                        return 0;
                }
 
-               esp_log_datastart("ESP: start data addr[%08x] len[%u] "
+               esp_log_datastart("ESP: start data addr[%08llx] len[%u] "
                                  "write(%d)\n",
-                                 dma_addr, dma_len, write);
+                                 (unsigned long long)dma_addr, dma_len, write);
 
                esp->ops->send_dma_cmd(esp, dma_addr, dma_len, dma_len,
                                       write, ESP_CMD_DMA | ESP_CMD_TI);
@@ -2032,6 +2029,7 @@ static void esp_reset_cleanup(struct esp *esp)
                        starget_for_each_device(tp->starget, NULL,
                                                esp_clear_hold);
        }
+       esp->flags &= ~ESP_FLAG_RESETTING;
 }
 
 /* Runs under host->lock */
@@ -2211,7 +2209,7 @@ static void __devinit esp_init_swstate(struct esp *esp)
 }
 
 /* This places the ESP into a known state at boot time. */
-static void __devinit esp_bootup_reset(struct esp *esp)
+static void esp_bootup_reset(struct esp *esp)
 {
        u8 val;
 
@@ -2355,7 +2353,7 @@ EXPORT_SYMBOL(scsi_esp_unregister);
 
 static int esp_slave_alloc(struct scsi_device *dev)
 {
-       struct esp *esp = host_to_esp(dev->host);
+       struct esp *esp = shost_priv(dev->host);
        struct esp_target_data *tp = &esp->target[dev->id];
        struct esp_lun_data *lp;
 
@@ -2379,7 +2377,7 @@ static int esp_slave_alloc(struct scsi_device *dev)
 
 static int esp_slave_configure(struct scsi_device *dev)
 {
-       struct esp *esp = host_to_esp(dev->host);
+       struct esp *esp = shost_priv(dev->host);
        struct esp_target_data *tp = &esp->target[dev->id];
        int goal_tags, queue_depth;
 
@@ -2421,7 +2419,7 @@ static void esp_slave_destroy(struct scsi_device *dev)
 
 static int esp_eh_abort_handler(struct scsi_cmnd *cmd)
 {
-       struct esp *esp = host_to_esp(cmd->device->host);
+       struct esp *esp = shost_priv(cmd->device->host);
        struct esp_cmd_entry *ent, *tmp;
        struct completion eh_done;
        unsigned long flags;
@@ -2537,7 +2535,7 @@ out_failure:
 
 static int esp_eh_bus_reset_handler(struct scsi_cmnd *cmd)
 {
-       struct esp *esp = host_to_esp(cmd->device->host);
+       struct esp *esp = shost_priv(cmd->device->host);
        struct completion eh_reset;
        unsigned long flags;
 
@@ -2573,7 +2571,7 @@ static int esp_eh_bus_reset_handler(struct scsi_cmnd *cmd)
 /* All bets are off, reset the entire device.  */
 static int esp_eh_host_reset_handler(struct scsi_cmnd *cmd)
 {
-       struct esp *esp = host_to_esp(cmd->device->host);
+       struct esp *esp = shost_priv(cmd->device->host);
        unsigned long flags;
 
        spin_lock_irqsave(esp->host->host_lock, flags);
@@ -2613,7 +2611,7 @@ EXPORT_SYMBOL(scsi_esp_template);
 
 static void esp_get_signalling(struct Scsi_Host *host)
 {
-       struct esp *esp = host_to_esp(host);
+       struct esp *esp = shost_priv(host);
        enum spi_signal_type type;
 
        if (esp->flags & ESP_FLAG_DIFFERENTIAL)
@@ -2627,7 +2625,7 @@ static void esp_get_signalling(struct Scsi_Host *host)
 static void esp_set_offset(struct scsi_target *target, int offset)
 {
        struct Scsi_Host *host = dev_to_shost(target->dev.parent);
-       struct esp *esp = host_to_esp(host);
+       struct esp *esp = shost_priv(host);
        struct esp_target_data *tp = &esp->target[target->id];
 
        tp->nego_goal_offset = offset;
@@ -2637,7 +2635,7 @@ static void esp_set_offset(struct scsi_target *target, int offset)
 static void esp_set_period(struct scsi_target *target, int period)
 {
        struct Scsi_Host *host = dev_to_shost(target->dev.parent);
-       struct esp *esp = host_to_esp(host);
+       struct esp *esp = shost_priv(host);
        struct esp_target_data *tp = &esp->target[target->id];
 
        tp->nego_goal_period = period;
@@ -2647,7 +2645,7 @@ static void esp_set_period(struct scsi_target *target, int period)
 static void esp_set_width(struct scsi_target *target, int width)
 {
        struct Scsi_Host *host = dev_to_shost(target->dev.parent);
-       struct esp *esp = host_to_esp(host);
+       struct esp *esp = shost_priv(host);
        struct esp_target_data *tp = &esp->target[target->id];
 
        tp->nego_goal_width = (width ? 1 : 0);