- spin_lock_irqsave(&scsi_id->cmd_orb_lock, flags);
- while (!list_empty(&scsi_id->cmd_orb_inuse)) {
- lh = scsi_id->cmd_orb_inuse.next;
- command = list_entry(lh, struct sbp2_command_info, list);
- pci_dma_sync_single_for_cpu(hi->host->pdev, command->command_orb_dma,
- sizeof(struct sbp2_command_orb),
- PCI_DMA_TODEVICE);
- pci_dma_sync_single_for_cpu(hi->host->pdev, command->sge_dma,
- sizeof(command->scatter_gather_element),
- PCI_DMA_BIDIRECTIONAL);
- sbp2util_mark_command_completed(scsi_id, command);
- if (command->Current_SCpnt) {
- command->Current_SCpnt->result = status << 16;
- command->Current_done(command->Current_SCpnt);
+ spin_lock_irqsave(&lu->cmd_orb_lock, flags);
+ while (!list_empty(&lu->cmd_orb_inuse)) {
+ lh = lu->cmd_orb_inuse.next;
+ cmd = list_entry(lh, struct sbp2_command_info, list);
+ pci_dma_sync_single_for_cpu(hi->host->pdev,
+ cmd->command_orb_dma,
+ sizeof(struct sbp2_command_orb),
+ PCI_DMA_TODEVICE);
+ pci_dma_sync_single_for_cpu(hi->host->pdev, cmd->sge_dma,
+ sizeof(cmd->scatter_gather_element),
+ PCI_DMA_BIDIRECTIONAL);
+ sbp2util_mark_command_completed(lu, cmd);
+ if (cmd->Current_SCpnt) {
+ cmd->Current_SCpnt->result = status << 16;
+ cmd->Current_done(cmd->Current_SCpnt);