aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/esp_scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/esp_scsi.c')
-rw-r--r--drivers/scsi/esp_scsi.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 71caf2ded6ba..77b06a983fa7 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -324,17 +324,14 @@ static void esp_reset_esp(struct esp *esp)
324static void esp_map_dma(struct esp *esp, struct scsi_cmnd *cmd) 324static void esp_map_dma(struct esp *esp, struct scsi_cmnd *cmd)
325{ 325{
326 struct esp_cmd_priv *spriv = ESP_CMD_PRIV(cmd); 326 struct esp_cmd_priv *spriv = ESP_CMD_PRIV(cmd);
327 struct scatterlist *sg = cmd->request_buffer; 327 struct scatterlist *sg = scsi_sglist(cmd);
328 int dir = cmd->sc_data_direction; 328 int dir = cmd->sc_data_direction;
329 int total, i; 329 int total, i;
330 330
331 if (dir == DMA_NONE) 331 if (dir == DMA_NONE)
332 return; 332 return;
333 333
334 BUG_ON(cmd->use_sg == 0); 334 spriv->u.num_sg = esp->ops->map_sg(esp, sg, scsi_sg_count(cmd), dir);
335
336 spriv->u.num_sg = esp->ops->map_sg(esp, sg,
337 cmd->use_sg, dir);
338 spriv->cur_residue = sg_dma_len(sg); 335 spriv->cur_residue = sg_dma_len(sg);
339 spriv->cur_sg = sg; 336 spriv->cur_sg = sg;
340 337
@@ -407,8 +404,7 @@ static void esp_unmap_dma(struct esp *esp, struct scsi_cmnd *cmd)
407 if (dir == DMA_NONE) 404 if (dir == DMA_NONE)
408 return; 405 return;
409 406
410 esp->ops->unmap_sg(esp, cmd->request_buffer, 407 esp->ops->unmap_sg(esp, scsi_sglist(cmd), spriv->u.num_sg, dir);
411 spriv->u.num_sg, dir);
412} 408}
413 409
414static void esp_save_pointers(struct esp *esp, struct esp_cmd_entry *ent) 410static void esp_save_pointers(struct esp *esp, struct esp_cmd_entry *ent)
@@ -921,7 +917,7 @@ static void esp_event_queue_full(struct esp *esp, struct esp_cmd_entry *ent)
921static int esp_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 917static int esp_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
922{ 918{
923 struct scsi_device *dev = cmd->device; 919 struct scsi_device *dev = cmd->device;
924 struct esp *esp = host_to_esp(dev->host); 920 struct esp *esp = shost_priv(dev->host);
925 struct esp_cmd_priv *spriv; 921 struct esp_cmd_priv *spriv;
926 struct esp_cmd_entry *ent; 922 struct esp_cmd_entry *ent;
927 923
@@ -2357,7 +2353,7 @@ EXPORT_SYMBOL(scsi_esp_unregister);
2357 2353
2358static int esp_slave_alloc(struct scsi_device *dev) 2354static int esp_slave_alloc(struct scsi_device *dev)
2359{ 2355{
2360 struct esp *esp = host_to_esp(dev->host); 2356 struct esp *esp = shost_priv(dev->host);
2361 struct esp_target_data *tp = &esp->target[dev->id]; 2357 struct esp_target_data *tp = &esp->target[dev->id];
2362 struct esp_lun_data *lp; 2358 struct esp_lun_data *lp;
2363 2359
@@ -2381,7 +2377,7 @@ static int esp_slave_alloc(struct scsi_device *dev)
2381 2377
2382static int esp_slave_configure(struct scsi_device *dev) 2378static int esp_slave_configure(struct scsi_device *dev)
2383{ 2379{
2384 struct esp *esp = host_to_esp(dev->host); 2380 struct esp *esp = shost_priv(dev->host);
2385 struct esp_target_data *tp = &esp->target[dev->id]; 2381 struct esp_target_data *tp = &esp->target[dev->id];
2386 int goal_tags, queue_depth; 2382 int goal_tags, queue_depth;
2387 2383
@@ -2423,7 +2419,7 @@ static void esp_slave_destroy(struct scsi_device *dev)
2423 2419
2424static int esp_eh_abort_handler(struct scsi_cmnd *cmd) 2420static int esp_eh_abort_handler(struct scsi_cmnd *cmd)
2425{ 2421{
2426 struct esp *esp = host_to_esp(cmd->device->host); 2422 struct esp *esp = shost_priv(cmd->device->host);
2427 struct esp_cmd_entry *ent, *tmp; 2423 struct esp_cmd_entry *ent, *tmp;
2428 struct completion eh_done; 2424 struct completion eh_done;
2429 unsigned long flags; 2425 unsigned long flags;
@@ -2539,7 +2535,7 @@ out_failure:
2539 2535
2540static int esp_eh_bus_reset_handler(struct scsi_cmnd *cmd) 2536static int esp_eh_bus_reset_handler(struct scsi_cmnd *cmd)
2541{ 2537{
2542 struct esp *esp = host_to_esp(cmd->device->host); 2538 struct esp *esp = shost_priv(cmd->device->host);
2543 struct completion eh_reset; 2539 struct completion eh_reset;
2544 unsigned long flags; 2540 unsigned long flags;
2545 2541
@@ -2575,7 +2571,7 @@ static int esp_eh_bus_reset_handler(struct scsi_cmnd *cmd)
2575/* All bets are off, reset the entire device. */ 2571/* All bets are off, reset the entire device. */
2576static int esp_eh_host_reset_handler(struct scsi_cmnd *cmd) 2572static int esp_eh_host_reset_handler(struct scsi_cmnd *cmd)
2577{ 2573{
2578 struct esp *esp = host_to_esp(cmd->device->host); 2574 struct esp *esp = shost_priv(cmd->device->host);
2579 unsigned long flags; 2575 unsigned long flags;
2580 2576
2581 spin_lock_irqsave(esp->host->host_lock, flags); 2577 spin_lock_irqsave(esp->host->host_lock, flags);
@@ -2615,7 +2611,7 @@ EXPORT_SYMBOL(scsi_esp_template);
2615 2611
2616static void esp_get_signalling(struct Scsi_Host *host) 2612static void esp_get_signalling(struct Scsi_Host *host)
2617{ 2613{
2618 struct esp *esp = host_to_esp(host); 2614 struct esp *esp = shost_priv(host);
2619 enum spi_signal_type type; 2615 enum spi_signal_type type;
2620 2616
2621 if (esp->flags & ESP_FLAG_DIFFERENTIAL) 2617 if (esp->flags & ESP_FLAG_DIFFERENTIAL)
@@ -2629,7 +2625,7 @@ static void esp_get_signalling(struct Scsi_Host *host)
2629static void esp_set_offset(struct scsi_target *target, int offset) 2625static void esp_set_offset(struct scsi_target *target, int offset)
2630{ 2626{
2631 struct Scsi_Host *host = dev_to_shost(target->dev.parent); 2627 struct Scsi_Host *host = dev_to_shost(target->dev.parent);
2632 struct esp *esp = host_to_esp(host); 2628 struct esp *esp = shost_priv(host);
2633 struct esp_target_data *tp = &esp->target[target->id]; 2629 struct esp_target_data *tp = &esp->target[target->id];
2634 2630
2635 tp->nego_goal_offset = offset; 2631 tp->nego_goal_offset = offset;
@@ -2639,7 +2635,7 @@ static void esp_set_offset(struct scsi_target *target, int offset)
2639static void esp_set_period(struct scsi_target *target, int period) 2635static void esp_set_period(struct scsi_target *target, int period)
2640{ 2636{
2641 struct Scsi_Host *host = dev_to_shost(target->dev.parent); 2637 struct Scsi_Host *host = dev_to_shost(target->dev.parent);
2642 struct esp *esp = host_to_esp(host); 2638 struct esp *esp = shost_priv(host);
2643 struct esp_target_data *tp = &esp->target[target->id]; 2639 struct esp_target_data *tp = &esp->target[target->id];
2644 2640
2645 tp->nego_goal_period = period; 2641 tp->nego_goal_period = period;
@@ -2649,7 +2645,7 @@ static void esp_set_period(struct scsi_target *target, int period)
2649static void esp_set_width(struct scsi_target *target, int width) 2645static void esp_set_width(struct scsi_target *target, int width)
2650{ 2646{
2651 struct Scsi_Host *host = dev_to_shost(target->dev.parent); 2647 struct Scsi_Host *host = dev_to_shost(target->dev.parent);
2652 struct esp *esp = host_to_esp(host); 2648 struct esp *esp = shost_priv(host);
2653 struct esp_target_data *tp = &esp->target[target->id]; 2649 struct esp_target_data *tp = &esp->target[target->id];
2654 2650
2655 tp->nego_goal_width = (width ? 1 : 0); 2651 tp->nego_goal_width = (width ? 1 : 0);